The load event is fired when a resource and its dependent resources have finished loading.
window.addEventListener("load", function(event) {
console.log("All resources finished loading!");
});
The DOMContentLoaded event is fired when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading.
document.addEventListener("DOMContentLoaded", function(event) {
console.log("DOM fully loaded and parsed");
});