[removed] vs [removed]

后端 未结 9 1312

Which is more widely supported: window.onload or document.onload?

9条回答
  •  故里飘歌
    2020-11-21 06:23

    In Chrome, window.onload is different from , whereas they are the same in both Firefox(version 35.0) and IE (version 11).

    You could explore that by the following snippet:

    
    
        
            
            
            
    
            
        
    
        
    
            Page contents go here.
    
        
    
    

    And you will see both "window loaded"(which comes firstly) and "body onload" in Chrome console. However, you will see just "body onload" in Firefox and IE. If you run "window.onload.toString()" in the consoles of IE & FF, you will see:

    "function onload(event) { bodyOnloadHandler() }"

    which means that the assignment "window.onload = function(e)..." is overwritten.

提交回复
热议问题