1

For calculating page load time in desktop there are several extensions in chrome and Firefox. But i don't find any type of extensions in mobile browsers? How can i calculate page load time in mobiles?

  • use the device mode in chrome developer tools and then look at the network tab? – BenG May 25 '16 at 08:16
  • 1
    Can you use the console.time()/console.timeEnd() functions? such as illustrated here: http://stackoverflow.com/a/1975103/4561730 –  May 25 '16 at 08:18
  • If you pair that up(console.time/timeEnd) with monitoring the document.readystate, you should be able customize it for your use: https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState –  May 25 '16 at 08:27
  • @juan8a I have already tried using javascript functions. But that time is not matching with chrome extension page load time – user3315336 May 25 '16 at 08:40
  • You can use page 'load' event to monitor the complete loading and submit the measured time in event handler via ajax request to server in case you need to find out the time for your visitors without measurements for your own browser. – Oleksiy May 25 '16 at 08:45
  • if you're just running performance tests, use pagespeed insights https://developers.google.com/speed/pagespeed/insights/ – Rachel Gallen May 25 '16 at 10:09

1 Answers1

1

You can try using the Performance timing API, as it is supposed to measure relative to the performance.fetchstart (when the page started to load). Time 0 is measured when the page starts being fetched (performance.fetchstart), and the calls to performance.now fetch the time in milliseconds relative to fetchstart.

I don't think you need to put the script in the head as I did below since the time measurement relative to the page fetch will be done only when the page "load" event fires and triggers the callback.

<!doctype>
<html>
  <head>
    <!-- HEAD content stuff -->
    <script>
      document.addEventListener("load", function(event) {
        var t1 = performance.now();
        console.log("PageLoad duration: " + t1 + " milliseconds.")
      });
    </script>
  </head>
  <body>
    <!-- Page structure/content stuff, etc ... -->
  </body>
</html>

See the JSFiddle

More on these APIs: When milliseconds are not enough: performance.now

Performance.now (MDN)