Re: code fails without focus in tab
mike durakovich <[email protected]> Mon, 8 Mar 2010 13:19:19 -0800 (PST)
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
eternicode also gave me this code (http://snipplr.com/view/28460/ffext-
modify-any-page-on-pageload-including-background-tabs/) but it didn't
work either when I fit it to my code:
function set_pageload(browser)
{browser.addEventListener("DOMContentLoaded", pageload, false)}
function add_tab(e){set_pageload(e.target.linkedBrowser)}
function pageload(){
var doc = this.contentWindow.document
// modify page using "doc" as "document"
}
window.addEventListener("load", function(){
// Listen to first page/tab
set_pageload(gBrowser.mPanelContainer.firstChild.firstChild)
// Listen to other pages/tabs as they are opened
gBrowser.tabContainer.addEventListener("TabOpen", add_tab, false)
}, false)