window.onload vs document.onload
- It is fired when the entire page loads, including its content (images, css, scripts, etc.)
- It is fired when the DOM is ready which can be prior to images and other external content is loaded
- In general,
document.onloadevent is fired before the
Watch the following video to understand this concept with a practical example in detailed!