.onload called multiple times from Firefox extension

前端 未结 1 959
说谎
说谎 2021-02-06 04:09

I\'m developing a Firefox extension and have the following code:

function initialize() { 
    // For accessing browser window from sidebar code.
    var mainWind         


        
相关标签:
1条回答
  • 2021-02-06 04:49

    From https://developer.mozilla.org/en/Code_snippets/On_page_load

    Current Firefox trunk nightlies will fire the onPageLoad function for not only documents, but xul:images (favicons in tabbrowser). If you only want to handle documents, ensure aEvent.originalTarget.nodeName == "#document"

    If you're still seeing extraneous 'load' events firing, you may want to inspect the event target to figure out what's being loaded, and use similar logic to avoid calling your extension's logic in certain specific cases.

    0 讨论(0)
提交回复
热议问题