How to get website loading time in browser

How to get website loading time in browser

Understanding the website and webpage loading time is very important. You can check the page loading time through javascript code. If you want to get the webpage loading time through javascript. This very easily achievable using javascript. If you want to get the webpage loading time through javascript. This easily achievable using javascript. We have code to get website loading time in browser

How to get website loading time in browser

You just need to use following code in your head tag


var starttime = new Date().getTime();
window.onload=function() {
 var loading_time = new Date().getTime()-starttime;

 alert('Webpage loading time in ' + loading_time + 'ms - milisecond');
}

 

How to get website loading time in browser
How to get website loading time in browser

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

One thought on “How to get website loading time in browser”

  1. We were on Google Images looking for “loading” and came to your article. We tried the code in the header but the code was shown over the content.

    Is this a .php script? How would you rework it for .shtml?

Leave a Reply

Your email address will not be published.