Display 'Hello World' with a Firefox extension
Does somebody know of a way to display 'Hello World' in a blank pag开发者_运维知识库e when a user of Firefox opens a new tab (with an extension) ?
Use this on your XUL file:
gBrowser.addEventListener("DOMContentLoaded",
function(e) {
var contentWindow = e.originalTarget.defaultView;
contentWindow//.getElementById, tagName, etc...
}, false);
contentWindow
is the wrapped window
of that tab.
For the raw window (Same window if you type a script on the address bar) see this.
精彩评论