Web Browser - Load Event

1 - About

The load event is fired by the browser.

3 - Example

3.1 - Image

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

<img src="/_media/resume/nico.jpg" onLoad="console.log('The image has loaded')" />

3.2 - Page


With a onLoad IDL event handler, you also check if the window (ie page) has finished loading.

window.onload = () => { console.log("The page has been loaded") };

4 - Other

4.1 - 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');


Data Science
Data Analysis
Data Science
Linear Algebra Mathematics

Powered by ComboStrap