For the window.onload by default, it fires only when the entire page loads, including its content which are the images and scripts. However, in various search engines it now takes over the role of document.onload and then fires when the DOM is ready. For the document.onload it is called only when the DOM is ready in which it can be prior to the images and only once the other external content is loaded. The most widely supported out of the two is the window.onload, and also some of the most modern internets have worked and successfully replaced document.onload with window.onload. However in issues related to the internet, in particular support issues are the crux of why many users are using libraries like jQuery to check whether or not the entire document is ready. It is done with the following commands:-
$(document).ready(function() { /* code here */ });
$(function() { /* code here */ });