Get page load time via Javascript and jQuery

//calculate the time before calling the function in window.onload var beforeload = (new Date()).getTime(); function getPageLoadTime(){ //calculate the current time in afterload var afterload = (new Date()).getTime(); // now use the beforeload and afterload to calculate the seconds seconds = (afterload-beforeload) / 1000; // Place the seconds in the innerHTML to show the results $("#load_time").text('Page load time :: ' + seconds + ' sec(s).'); } window.onload = getPageLoadTime;

1 Response

ggg

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.