Call something when the entire page has loaded


Fri Nov 20 2020 06:06:10 GMT+0000 (Coordinated Universal Time)

Saved by @eneki

window.addEventListener('load', (event) => {
    console.log('The page has fully loaded');

For the window object, the load event is fired when the whole webpage (HTML) has loaded fully, including all dependent resources such as JavaScript files, CSS files, and images. To handle the load event, you register an event listener using the addEventListener() method: