When document.readystate==complete is that the same when onload fires?
In Internet Explorer, when onreadystatechange
is fired, and readystate
switches to complete, is that the same time onload
event triggers? Have all t开发者_开发知识库he requests completed by this time?
document.onreadystatechange
is typically more optimal than window.onload
as it fires before all external resources such as images are loaded. However, it's not well supported at the moment (but if you're only concerned with IE, then it's not a problem).
See: https://developer.mozilla.org/en/DOM/document.onreadystatechange
Or, for IE: http://msdn.microsoft.com/en-us/library/ms536957(v=vs.85).aspx
document.readyState
is a property and window.onload
is an event
http://www.w3schools.com/jsref/prop_doc_readystate.asp
http://www.w3schools.com/js/js_events.asp
精彩评论