如何在页面加载时间内存储js加载时间?

时间:2015-08-10 12:53:12

标签: javascript

的exaple: -

从这一方面,您可以看到有关页面的所有信息。 http://tools.pingdom.com/fpt/#!/b9eJAg/www.google.com

我们如何存储我们的所有页面。

1 个答案:

答案 0 :(得分:0)

试试这个:

<doctype html>
<html>
<head>
    <script type="text/javascript">
       var timerStart = Date.now();
    </script>
    <!-- do all the stuff you need to do -->
</head>
<body>
    <!-- put everything you need in here -->

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

    <script type="text/javascript">
         $(document).ready(function() {
             console.log("Time until DOMready: ", Date.now()-timerStart);
         });
         $(window).load(function() {
             console.log("Time until everything loaded: ", Date.now()-timerStart);
         });
    </script>
</body>
</html>

来源: https://stackoverflow.com/a/14343144/3185456