// Calculates 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;
Use this snippet above to get page load time using jQuery.
#pageload #time #jquery
#cesarnog
#pageload #time #jquery
#cesarnog
Be the first to 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.