View Full Version : Time it took to load
Mik3
March 30th, 2003, 11:38 PM
What's the code and what code is it to show how long the page took to load?
like at google.com
liam
March 31st, 2003, 06:46 PM
you could do something like this:
place the following in the < head > section of your page:
<SCRIPT LANGUAGE="javascript">
loadtime="0"
loading=true
s="s"
{refresh()}
function refresh()
{setTimeout("count()",250)}
function count()
{if (loading)
{loadtime=loadtime+++0.25;refresh()}}
function done()
{if (loadtime==1)
{s=""}
document.write("It took "+loadtime+" second"+s+" to load the page");loading=false}
</script>
then, modify your < body > tag to add the onLoad function:
<body onLoad="done()">
hope that works!
lostinbeta
March 31st, 2003, 06:55 PM
Wow, that is a nice script Liam. Did you write that yourself?
Also... you can also define the onLoad command inside the original script instead of the body tag if you wanted to :)
liam
March 31st, 2003, 07:03 PM
yeah, i wrote it... took some time but i managed to figure it out!
thanks, lost, i never thought of defining it in the original script!
lostinbeta
March 31st, 2003, 07:06 PM
Well I don't have time to test it out, but I take your word it works because I see no point in you posted code you tested, but it didn't work :P
:A+: I might find this useful in the future now that I think about it. I appreciate the time you spent to write this :)
liam
March 31st, 2003, 07:10 PM
anytime :geek:
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.