So we have the webpage, and below that, a script with window.onload
/ document.onload
listener.
When the browser loads the page, imagine that the webpage is loaded before reach the line code of the listener. It will fire anyway?
So we have the webpage, and below that, a script with window.onload
/ document.onload
listener.
When the browser loads the page, imagine that the webpage is loaded before reach the line code of the listener. It will fire anyway?
If you add a load
event handler after the load event has fired, then the event handler will not be called.
It's the same as any other event.
addEventListener("load", () => {
console.log("Load event");
addEventListener("load", () => {
console.log("Second load event");
});
});
, and inside the load listener, it's not supposed to fire after load all the script?
– Angel Luis Jan 14 '19 at 20:17