[Javascript] Measuring time to load page

Troy III Ajnej trojani2000 at hotmail.com
Sun Jul 24 20:44:47 CDT 2005


First try this script and than go to it's Internet source and giv'em some 
feedback

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<script type="text/javascript">
<!-- Begin
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Abraham Joffe :: http://www.abrahamjoffe.com.au/ */

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;
}

var loopTime=setInterval("currentTime()",100);
window.onload=function(){
  clearTimeout(loopTime);
}

// End -->
</script>
</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document  -->

<BODY>

<script type="text/javascript">
<!-- Begin
  document.write('This page took <span id="endTime">0.0</span> seconds to 
load.');
// End -->
</script>

<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

Cheers!
>From: Vinayakam Murugan <mvinayakam at gmail.com>
>Reply-To: "\[JavaScript List\]" <javascript at LaTech.edu>
>To: "[JavaScript List]" <javascript at latech.edu>
>Subject: [Javascript] Measuring time to load page
>Date: Sat, 23 Jul 2005 12:03:30 -0700
>
>Hi
>
>I am working on a website which has to run on a kiosk like environment.
>Performance is very crucial here. I would like to measure the time it takes
>to load a page. I have tried
>
><script >
>//Record Start Time
></script>
>
>HTML Code
>
><script>
>//Record End Time
>//Display both time
></script>
>
>Is this the most accurate way this can be measured? What happens if there 
>is
>a heavy image and it is being fetched from the server. I want to know the
>time taken to display all the elements on the page completely.
>
>--
>Warm Regards
>~~~~~~~~~~~~~~~
>Vinayak
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/




More information about the Javascript mailing list