Search This Blog

Saturday, November 21, 2009

FirefoxExtension, Tabbed Browser

Tabbed Browser can help you access the content of each tab. You can think each tab is a single browser. Once you have reached the contentDocument object, you can get the body element or URL element to do useful things according to your javascript logic.

On Page Load event is useful too if you want your extension to auto start when a tab is fully loaded.

Tabbed Browser:
gBrowser.AddTab("http://google.com");
gBrowser.contentDocument.URL;
gBrowser.contentDocument.body.setAttribute("style","background-color:blue");

you can also get the mostRecentWindow with nsIWindowMediator

On Page Load:

getElementById("appcontent")

No comments: