Posted By

eternicode on 02/16/10


Tagged

javascript Firefox extension mdc addon


Versions (?)

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


 / Published in: JavaScript
 

  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  

You need to login to post a comment.