Include in HTML page with
defer like above
defer
window.onload = function() { init(); doSomethingElse(); };
window.onloadarrow-up-right
By default, it is fired when the entire page loads, including its content (images, css, scripts, etc.)
In some browsers it now takes over the role of document.onload and fires when the DOM is ready as well.
document.onload
It is called when the DOM is ready which can be prior to images and other external content is loaded.
Last updated 6 years ago