Page loading time script for blogger blog

Today I am giving a script which will tell about the loading time of any page of your blogger blog. If you search Google for this kind of 'page load timer script' to show your page loading time then you will get some html code. But none of them are made for Blogger.com blog. But with this script which I am publishing now you can get actual loading time of your blogger blog page.

You can use this javascript code to show how long a blogpost taking to load. A automatic timer will starts when a page begin to parse and timer will stop when that page has completed loading all content.

Here is the code and installing instruction.

Login in you blogger.com blog. Then copy and paste the code below after<head>
<script type='text/javascript'>
var d = new Date();
var starttime = d.getTime(); //Get the start time
</script>
Now find and paste this code before </body>
<script type='text/javascript'>
var d2 = new Date();
var endtime = d2.getTime(); //Get the end time
//Find the difference between the start and end times
var totaltime = (endtime - starttime)/1000;
//Round 2 decimal places
var result = Math.round(totaltime*100)/100;
//Output results to a "P" element
document.getElementById("loadtime").innerHTML = "Page loading time: "+ result +" seconds";
</script>
At last get a html gadget in Design>Page Elements and paste this code into any Html/ Javascript widget-
<p id="loadtime">Loading....(You may write any custom message here)</p>
I wish you won't get any problem to install the codes in your blogger.com blog. If you face any problem please comment here to inform me.

3 comments:

  1. Yes, its working..., but how to place the Loading text at the center of the screen (not at the widget place) and after the loading finish the text will vanish.

    ReplyDelete
  2. this is very, very, very. Thanx!

    ReplyDelete
  3. thank you , there is not anywhere...

    ReplyDelete

Please help me to improve my English. Please Email me or comment below. Thanks...