FFExt: Modify any page on pageload (including background tabs)


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function set_pageload(browser){browser.addEventListener("DOMContentLoaded", pageload, false)}
  2. function add_tab(e){set_pageload(e.target.linkedBrowser)}
  3. function pageload(){
  4. var doc = this.contentWindow.document
  5.  
  6. // modify page using "doc" as "document"
  7. }
  8.  
  9. window.addEventListener("load", function(){
  10. // Listen to first page/tab
  11. set_pageload(gBrowser.mPanelContainer.firstChild.firstChild)
  12. // Listen to other pages/tabs as they are opened
  13. gBrowser.tabContainer.addEventListener("TabOpen", add_tab, false)
  14. }, false)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.