如何使用 Jquery/Javascript 计算 Asp.net 页面的加载时间?

发布于 2024-12-06 02:32:16 字数 142 浏览 0 评论 0原文

我正在开发一个网络应用程序,因为我想检查每个页面的加载时间或控制加载时间。

加载整个页面内容需要多长时间?
我想计算 asp.net 页面加载时间(以微秒/秒为单位),

我如何知道使用 Javascript/Jquery ?

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 Time in Micro second/Second,

How can I know using Javascript/Jquery ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

白云悠悠 2024-12-13 02:32:16

以下脚本可以帮助您;

<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>

参考来源:http://www.dreamincode.net/code/snippet1908.htm

或者

如果您只是想检查时间,请使用 Firefox 的 Firebug 来显示执行时间。
像这样的 在此处输入图像描述

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 enter image description here

小清晰的声音 2024-12-13 02:32:16

由 stackoverflow 的优秀人员开发 - 方便的小型分析工具 - 可能适合您:

http: //code.google.com/p/mvc-mini-profiler/

Developed by the good people at stackoverflow - handy little profiling tool - may work for you:

http://code.google.com/p/mvc-mini-profiler/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文