Forum Load Time Indicator

MobileHacks

New Member
Well with this simple little hack that sits queitly at the bottom of your footer. A timer starts when the page begins to parse and ends when it has completed loading all of the content. The result is the time in seconds of how fast (or slow) your forums are loading.

choose the skin you want this showing and,

Insert this bottom of the header template:
PHP:
<script type="text/javascript">
<!-- Begin


var startTime=new Date();

function currentTime(){
  var a=Math.floor((new Date()-startTime)/100)/10;
  if (a%1==0) a+=".0";
  document.getElementById("endTime").innerHTML=a;
}

window.onload=function(){
  clearTimeout(loopTime);
}

// End -->
</script>
Insert this bit of code on the next line below the vb time code in footer template as wanted it to show below the time but you can add it where you chose:
PHP:
<div align="center">
<script type="text/javascript">
<!-- Begin
  document.write('This Page took <span id="endTime">0.0</span> seconds to load.');
  var loopTime=setInterval("currentTime()",100);
// End -->
</script>
</div>
 
I have to say thank you again...I have used this so many times.

Oh, and I got a new host...1.7 seconds for a heavy-imaged forum :)

The only issue is it does not work under IE8. :(

It could just be my computer though...I am running Windows 7 right now.
 
LinkFire said:
I have to say thank you again...I have used this so many times.

Oh, and I got a new host...1.7 seconds for a heavy-imaged forum :)

The only issue is it does not work under IE8. :(

It could just be my computer though...I am running Windows 7 right now.

IE8 has a new loading sequence I'm guessing so the onLoad automatically defaults to after the whole page has finished loading. Yay for standard compliancy -.-
 
Back
Top