Closed Thread Icon

Preserved Topic: Need Page Load Timer (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8378" title="Pages that link to Preserved Topic: Need Page Load Timer (Page 1 of 1)" rel="nofollow" >Preserved Topic: Need Page Load Timer <span class="small">(Page 1 of 1)</span>\

 
ZOD
Bipolar (III) Inmate

From:
Insane since: Jun 2002

posted posted 11-04-2002 18:44

Does anyone have a fast and accurate JS profiler that can display the time it takes a browser (any browser) to fully render a page?

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 11-04-2002 19:03

I think Mozilla has something like this, though I haven't taken the time to look at it myself...

ZOD
Bipolar (III) Inmate

From:
Insane since: Jun 2002

posted posted 11-04-2002 19:14

Thanks Slime, but what I need is a script that will run in most browsers. I already have a modified script I found elsewhere (sorry I don't remember) but it lacks accuracy. Here it is.

code:
<SCRIPT>
loadtime="0"
loading=true
s="s"
{refresh()}
function refresh() {setTimeout("count()",100)}
function count()
{if (loading)
{loadtime=loadtime+++0.001;refresh()}}
function done()
{if (loadtime==1)
{s=""}
alert("It took "+loadtime+" second"+s+" to load the page");loading=false}
window.onload=done;
</script>



Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 11-04-2002 19:54

Oh, something like that? This will work:

beginning of page, first thing in the <head> tags:
<script type="text/javascript">
var starttime = new Date();
</script>

end of page, last thing in the <body> tags:
<script type="text/javascript">
var endtime = new Date();
document.write('the page took ' + (endtime.getTime()-starttime.getTime())/1000 + ' seconds to load.');
</script>

ZOD
Bipolar (III) Inmate

From:
Insane since: Jun 2002

posted posted 11-05-2002 03:01

Duh! I don't know why I didn't think of that. Thanks for jogging my brain. Based on your script here is what I came up with which is added to the very beginning of the document.

code:
<script type="text/javascript">
var starttime = new Date();
function endT() {
var endtime = new Date();
alert(' Load Time: '+(endtime.getTime()-starttime.getTime())/1000+' second(s)');
}
</script>



I then add 'endT();' to the body onload attrib or immediately following the current handler if there is already one defined as in onload="firstFunc(); endT();". I haven't actually tested that last part but it should work.



ZOD
Bipolar (III) Inmate

From:
Insane since: Jun 2002

posted posted 11-15-2002 20:42

If there are any Proxomitron users about, here are some filters I wrote which will inject the above scripts into any page you please. It may not give accurate results for a page for which the window.onload event is already defined because the second filter replaces it, but since one of the most common uses of the onload event is to load in-your-face SPAM, who cares if that crap gets lost along the way.

These filters have been successfully tested in IE6SP1, Mozilla 1.1 and Opera 7b.

code:
[Patterns]
Name = "Load Timer v2.0 Part Ib (Slime)"
Active = TRUE
URL = "$TYPE(htm)"
Limit = 7
Match = "<start>"
Replace = "<script>\r\n"
"var pxst = new Date();\r\n"
"function endT() {\r\n"
"var pxet = new Date();\r\n"
"document.title=(' Load Time: '+(pxet.getTime()-pxst.getTime())/1000+' second(s)');\r\n"
"}\r\n"
"</script>\r\n"
"$STOP()"

Name = "Load Timer v2.0 Part II"
Active = TRUE
URL = "$TYPE(htm)"
Limit = 5
Match = "<end>"
Replace = "<script>\r\n"
"window.onload=endT;\r\n"
"</script>\r\n"
"$STOP()"



« BackwardsOnwards »

Show Forum Drop Down Menu