Which is more widely supported: window.onload or document.onload?
Which is more widely supported: window.onload or document.onload ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When do they fire?
window.onloadIn some browsers it now takes over the role of
document.onloadand fires when the DOM is ready as well.document.onloadHow well are they supported?
window.onloadappears to be the most widely supported. In fact, some of the most modern browsers have in a sense replaceddocument.onloadwithwindow.onload.Browser support issues are most likely the reason why many people are starting to use libraries such as jQuery to handle the checking for the document being ready, like so:
For the purpose of history.
window.onloadvsbody.onload: