简体   繁体   English

我需要在执行任何代码之前在firefox 3.6扩展中获取window对象的句柄

[英]I need to get a handle on the window object in firefox 3.6 extension before any code is executed

从ff 3.6插件开始,我想在页面上的任何JS运行之前每次创建一个新的窗口对象时都得到通知-我尝试了“ load”事件,但似乎为时已晚,时间我得到对象的句柄,并且需要在运行任何JS之前进入,请问有人有什么想法吗?

You need to listen for the content-document-global-created notification, that's exactly what you are asking for - a window has been set up but no JavaScript code had a chance to execute yet. 您需要侦听content-document-global-created通知,这正是您所要的-已设置了一个窗口,但尚未执行任何JavaScript代码。 This is supported starting with Firefox 3.6.6. 从Firefox 3.6.6开始支持此功能。

You need to use nsIObserverService and register your observer for this topic. 您需要使用nsIObserverService并注册该主题的观察者。 When your observer is called the subject will be the newly created window. 调用观察者时,主题将是新创建的窗口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从扩展程序的javascript获取firefox浏览器窗口句柄 - Get the firefox browser window handle from the extension's javascript 在Firefox XUL中,如何获取弹出窗口的“文档”对象? - In Firefox XUL, How can I get the “document” object of a popup window? 在打开新窗口之前,如何确保单击功能中的所有代码都已执行? - How do I make sure all of the code in an on click function gets executed before opening a new window? 如何访问新打开的选项卡的窗口对象? [在Firefox扩展程序中] - How can I access a newly-opened tab's window object? [in a firefox extension] 在执行任何绑定的回调之前修改ajax响应 - Modify ajax response before any bound callbacks get executed 有什么方法可以将自己的代码注入QTP的Firefox 11扩展中 - Is there any way to inject own code into QTP's 11 Extension for Firefox 如何在 Firefox 扩展程序中关闭窗口时收到通知? - How to get notification when window closes in Firefox extension? 如何关闭浏览器Mozilla Firefox版本3.6到最新9.0的JavaScript窗口 - How can I close a window with javascript for browser Mozilla Firefox version 3.6 to latest 9.0 有没有办法在firefox扩展中的上下文菜单下获取单词? - Is there any way to get the word under the context menu in a firefox extension? 在事件$ window.ready之前从chrome扩展中执行代码 - Executing code from a chrome extension before the event $window.ready
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM