In Internet Explorer, when onreadystatechange
is fired, and readystate
switches to complete, is that the same time onload
event triggers? Have all the requests completed by this time?
The readyState of a document can be one of following: loading. The document is still loading. interactive. The document has finished loading and the document has been parsed but sub-resources such as scripts, images, stylesheets and frames are still loading.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With