element, where the browser shows a web page on a given domain (say, example.com).
Now there are several links on example.com. If a user follows a local link (i.e., stays on example.com) she should be allowed to follow. If on the other hand the link goes to elpmaxe.moc, there should be (I don't mind) any of those two possibilities:
Any ideas hwo to do this? It is not sufficient to use browser.document.onload or DOMready or such events, because the link has to be blocked safely even during page load (i.e., when none of these events fired yet).
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
看来您想要类似于 BlockSite 提供的功能 - 除了您想要将应用程序的域列入白名单并阻止其他所有内容。 有一些关于在 XUL Runner 中安装扩展的 MDC 文档可能会有所帮助。
或者,您可以查看源代码并尝试找出它的挂钩位置 - 这将使您实现另一种行为,而不是仅阻止并避免随应用程序发送扩展。 我认为 BlockSite.js 是关键文件,看起来处理程序被添加到此处(第 171 行):
BlockSiteObserver
函数在上面的代码中定义。It seems you want functionality similar to that provided by BlockSite - except you want to whitelist the app's domain and block everything else. There's some MDC documentation on installing extensions within XUL Runner which may help.
Alternatively you could have a look through the source code and try and work out where it hooks in - this would let you implement an alternative behaviour to just blocking and avoid shipping an extension with your app. I think BlockSite.js is the key file, looks like the handler gets added here (line 171):
The
BlockSiteObserver
function is defined in the code just above.