I need to do some action when a new tab opens in Firefox. I am using addon-sdk and I am completely new to developing Firefox extensions.
I downloaded several new tab extensions to the repository, unzip them and mostly use the following code from them:
var newtab = {
init: function ()
{
gBrowser.addEventListener("NewTab", newtab.opentab, false);
},
opentab: function (aEvent)
{
}
}
window.addEventListener( "load", newtab.init, false);
They subscribe to a window load event, after which they have gBrowser to subscribe to a new open tab event.
When I try to do this, I get:
Message: ReferenceError: window not defined
As I understand it, in this context there is no window object.
Firefox Addon-sdk. When loading page
stack overflow
sdk SO, , ( ), xul, .
SO answer Firefox Add-On window.addEventListener error: , Firefox .
? xul , ?