How to know if window “load” event was fired already

后端 未结 7 2064
独厮守ぢ
独厮守ぢ 2020-12-05 12:27

I\'m writing a Javascript script. This script will probably be loaded asynchronously (AMD format).

In this script, I\'d like to do nothing important until the

相关标签:
7条回答
  • 2020-12-05 13:28

    what about overriding window.load?

    window._load = window.load;
    window.load = function(){
      window.loaded = true;
      window._load();
    }
    

    Then check for

    if (window.loaded != undefined && window.loaded == true){
        //do stuff
    }
    
    0 讨论(0)
提交回复
热议问题