How to create a new tab in the Firefox extension and get the elements of the tab
I want to create a new Firefox extension where the new tab elements can be accessed specially the popup.
var win = Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Compon开发者_StackOverflow社区ents.interfaces.nsIWindowMediator)
.getMostRecentWindow('navigator:browser');
var a = win.gBrowser.selectedTab;
I want to access all the elements which remains open or will open in the new tab in the new tab; basically I want to know how to access the elements in the new tab.
Do you mean that you want to access the DOM of the page in the tab? If so you can use:
var doc = win.getBrowser.contentDocument;
精彩评论