【问题标题】:API for finding load time of a web page用于查找网页加载时间的 API
【发布时间】:2012-07-10 05:47:37
【问题描述】:

有没有API可以查询网页的加载时间?还有哪些其他方法可以查询网页的加载时间?

【问题讨论】:

    标签: java web-applications webpage


    【解决方案1】:

    参考http://www.hashemian.com/tools/page-load-time.htm

    这是简单的 JavaScript 网页加载时间代码(复制并粘贴到网页顶部):

    <script language="JavaScript">
    PLT_DisplayFormat = "Your connection took %%S%% seconds to load this page.";
    PLT_BackColor = "palegreen";
    PLT_ForeColor = "navy";
    PLT_FontPix = "12";
    PLT_DisplayElementID = "display_here";
    </script>
    <script language="JavaScript" src="http://www.hashemian.com/js/PageLoadTime.js"></script>
    

    示例:下面的行编码为:.

    Your connection took 8.486 seconds to load this page.

    【讨论】:

    • 谢谢你..但是如何提取加载时间值并将其存储在数据库中......我的问题是当我点击一个 url 我应该将加载时间存储在数据库中......跨度>
    • 查看PageLoadTime.js文件的代码PLT_DisplayFormat = PLT_DisplayFormat.replace(/%%S%%/g, ((new Date() - dt)/1000));这段代码可以帮助你。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-27
    • 1970-01-01
    • 1970-01-01
    • 2016-11-04
    相关资源
    最近更新 更多