JavaScript - window.onload Is Bad M’kay
According to Geek Daily you shouldn't use the window.onload command for a page with large files like images, animations, or video because there will be a huge delay before your code gets executed. This is because the onload event does not fire until every last piece of the page is loaded.
It is better to wait until the DOM is loaded and is able to be manipulated. Geek Daily shows you what code to use.
The onDomReady event accepts a function as a parameter and that function gets executed as soon as the DOM is available and before the rest of the media is done loading.
Comments
Be the first to write a comment
You must me logged in to write a comment.