Domcontentloaded

DOM event The DOMContentLoaded event is fired when the document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading (the load event can be used to detect a fully-loaded page).

Onload

'onload' is a JavaScript event that is run when a document is loaded



Preferable longer body

Example

"Sometimes it s preferable because onload event takes longer to fire then domcontentloaded"

from question  

Element width is undefined on document ready

"Remove the onload from your body element using domcontentloaded event instead the onload is less intrusive"

from question  

Changing all images on timer with JS

Others

Example

The onload handler is not exactely equal to the domcontentloaded handler but the onload handler has a better support and may be preferred here

from question  

Changing the contents of an href link

Back to Home
Data comes from Stack Exchange with CC-BY-SA-4.0