javascript - How to calculate page load time in mobile? -


for calculating page load time in desktop there several extensions in chrome , firefox. don't find type of extensions in mobile browsers? how can calculate page load time in mobiles?

you can try using performance timing api, supposed measure relative performance.fetchstart (when page started load). time 0 measured when page starts being fetched (performance.fetchstart), , calls performance.now fetch time in milliseconds relative fetchstart.

i don't think need put script in head did below since time measurement relative page fetch done when page "load" event fires , triggers 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 jsfiddle

more on these apis: when milliseconds not enough: performance.now

performance.now (mdn)


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -