Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Share On Stumbleupon
Contact us
Hide Buttons

window.onload vs document.onload

window.onload

  • It is fired when the entire page loads, includ­ing its con­tent (images, css, scripts, etc.)
  • $(window).load()

document.onload

  • It is fired when the DOM is ready which can be prior to images and other exter­nal con­tent is loaded
  • In gen­eral, document.onload event is fired before the window.onload
  • $(document).ready()
Watch the fol­low­ing video to under­stand this con­cept with a prac­ti­cal exam­ple in detailed!

You may also like...