I'm writing a Firefox extension. I'd like to have my code executed whenever a new tab opens.
I've tried this:
for (var i=0; i<Application.windows.length; i++) {
var w = Application.windows[i];
w.events.addListener("TabOpen", function(event){
alert( 'tab #'+w.activeTab.index +' opened');
});
}
It doesn't work right if windows.length > 1. For example, we have two windows. I open new tab and event fires 2 times, for every window. I wanna only one event call for current window.