是否有任何API可以找出网页的加载时间?有哪些方法可以找出网页的加载时间?
答案 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.