Web Browser - Load Event


The load event is fired by the browser.



With a onLoad content event handler, you can be updated when the image has finish loading

<img src="/_media/lenna.png" onLoad="console.log('Lenna has loaded')" width="200"/>

Page / Tab / Window

You can also check if the window (ie page) has finished loading.

window.addEventListener("load", () => { console.log("Event Listener: The page has been loaded") });
window.onload = () => { console.log("Idl: The page has been loaded") };


document - DOMContentLoaded

This is not a event called on load event but as it's really similar…

DOMContentLoaded is called when the DOM is ready which can be prior to images and other external content is loaded.

document.addEventListener('DOMContentLoaded', (event) => {
    console.log('DOM fully loaded and parsed');


Powered by ComboStrap