document.addEventListener("DOMContentLoaded", theDomHasLoaded, false); window.addEventListener("load", pageFullyLoaded, false); function theDomHasLoaded(e) { // do something } function pageFullyLoaded(e) { // do something again }