Time it took to load

What’s the code and what code is it to show how long the page took to load?
like at google.com

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!

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 :slight_smile:

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!

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 :stuck_out_tongue:

:A+: I might find this useful in the future now that I think about it. I appreciate the time you spent to write this :slight_smile:

anytime :geek: