用于查找网页加载时间的API

时间:2012-07-10 05:47:38

标签: java web-applications webpage

是否有任何API可以找出网页的加载时间?有哪些方法可以找出网页的加载时间?

1 个答案:

答案 0 :(得分:0)

参考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.