我可以用 javascript 将浏览器地址栏锁定到特定域吗?

发布于 2024-09-19 12:34:23 字数 388 浏览 6 评论 0原文

我对 Javascript 很陌生,到目前为止只使用过 DOM,但我现在需要访问浏览器模型,我不知道我想做的是否可行。

问题是:有时我让我最小的女儿浏览一些适合儿童的 Flash 游戏网站。问题是大多数 Flash 游戏都会在启动画面中显示指向其他网站的链接。我女儿经常选择一个游戏,然后在加载 Flash 游戏时,点击启动屏幕,这会将她带到其他网站。这让我发疯,因为她每两分钟就会打电话求助,因为浏览器会在其他网站上打开一个新选项卡。

我的具体需求: 我想知道 Javascript 是否有某种方法,比如使用书签或类似的东西,在任何特定时刻以某种伪信息亭模式锁定浏览器,因此它只跟踪当前域上 URL 的链接,即激活小书签时地址栏中的域。

我不希望有人为我解决整个问题,但如果有人指点,我将不胜感激。预先非常感谢。

I'm quite new at Javascript, and have so far only used the DOM, but I now need to access the browser model, and I don't know if what I'd like to do is possible.

The problem: sometimes I let my youngest daughter browse some kid-friendly Flash game sites. The problem is that most flash games display links to other sites in their splash screens. So often, my daughter chooses a game, and then, while the Flash game is loading, she clicks on the splash screen, which takes her to some other site. It drives me nuts, because every two minutes she calls for help, as the browser has opened a new tab on some other site.

My specific needs:
I wondered if there might be some way with Javascript, like with a bookmarklet or something alike, at any particular moment lock down the browser in some kind of pseudo-kiosk-mode, so it ONLY follows links to URLS on the current domain, ie the domain in the address bar when the bookmarklet was activated.

I don't expect anyone to solve the whole problem for me, but some pointers would be greatly appreciated. Thanks a lot in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

固执像三岁 2024-09-26 12:34:23

如果链接是从 Flash 打开的,您将无法执行任何操作。如果它是一个普通的 HTML 链接,您可以尝试拦截 click 事件,如果它是外部链接,则可以阻止它。但对于Flash,你就不走运了。

为此,您将需要某种浏览器扩展程序或外部监控软件。

If the link is being opened from Flash, you can't do anything about it. If it was a normal HTML link you could try to intercept the click event and block it if it's an external link. But with Flash, you're out of luck.

You're going to need some kind of browser extension or external monitoring software for that.

在风中等你 2024-09-26 12:34:23

扩展马蒂的说法,我发现有两种值得研究的方法。如果您搜索“your_browser kiosk”之类的内容,并将 your_browser 替换为浏览器的实际名称,您可能会找到一些有用的工具。或者,如果存在一组一致的问题站点,您可以修改主机文件以阻止这些站点的域。

Extending what Matti said, I see two approaches worth looking into. If you search for something like "your_browser kiosk", replacing your_browser with the actual name of your browser, you'll likely find some useful tools. Alternatively, if there is a consistent set of problem sites, you could modify your hosts file to block those sites' domains.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文