簡體   English   中英

我們如何存儲js加載時間和頁面加載時間?

[英]How can we store time of js load with page load time?

例如:-

從這一側,您可以查看有關頁面上方的所有信息。 http://tools.pingdom.com/fpt/#!/b9eJAg/www.google.com

我們如何存儲整個頁面。

嘗試這個:

<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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM