How to calculate load time of Asp.net page using Jquery/Javascript?
I am developing one web application in that I want to check load time of each and every page or controls load time..
How much time taken to load whole page contents? I want to calculate asp.net page load 开发者_StackOverflowTime in Micro second/Second,How can I know using Javascript/Jquery ?
Following script help you;
<SCRIPT LANGUAGE="JavaScript">
//calculate the time before calling the function in window.onload
beforeload = (new Date()).getTime();
function pageloadingtime()
{
//calculate the current time in afterload
afterload = (new Date()).getTime();
// now use the beforeload and afterload to calculate the seconds
secondes = (afterload-beforeload)/1000;
// If necessary update in window.status
window.status='You Page Load took ' + secondes + ' seconde(s).';
// Place the seconds in the innerHTML to show the results
document.getElementById("loadingtime").innerHTML = "<font color='red'>(You Page Load took " + secondes + " seconde(s).)</font>";
}
window.onload = pageloadingtime;
</SCRIPT>
Ref from : http://www.dreamincode.net/code/snippet1908.htm
or
If you just want to check the time make use of Firebug of firefox which display excution time. Something like this
Developed by the good people at stackoverflow - handy little profiling tool - may work for you:
http://code.google.com/p/mvc-mini-profiler/
精彩评论