How to count the DOM loading time in Javascript

To count the DOM loading time in Javascript you can use the following snippet.

Sample Javascript

var dateBefore = new Date();

window.onload = function() {
document.getElementById("aDivId").innerHTML = (new Date()).getTime() - dateBefore.getTime(); 	
}

2 thoughts on “How to count the DOM loading time in Javascript

Leave a Reply