Display the loading time for a page
Want to optimize your pages as much as possible? Here is a control routine that you may find very useful when developing your
Web pages. It displays (in seconds) the loading time for each page in the status bar. You can find out which pages are too
large and correct this problem.
Look in the status bar of your browser to see the result.
To obtain this display, insert the following script in the header of your page, between the tags
<head> and
</head>:
<SCRIPT LANGUAGE="JavaScript">
NavName = navigator.appName.substring(0,3);
NavVersion = navigator.appVersion.substring(0,1);
if (NavName != "Mic" || NavVersion>=4)
{
entree = new Date;
entree = entree.getTime();
}
function ZsortIe()
{
if (NavName != "Mic" || NavVersion>=4)
{
fin = new Date;
fin = fin.getTime();
secondes = (fin-entree)/1000;
window.status='Page chargée en ' + secondes + ' seconde(s).';
}
}
</SCRIPT>
Next make sure the script is loaded via the
onLoad attribute of the
<body> tag of your page:
<BODY onLoad="ZsortIe()">
The loading time for your pages will be displayed automatically in the status bar of your browser.
Discover all Webmaster tips.