Hi there,
I was wanting to calculate how long my web pages take to load, and to insert
this time into my HTML source code (not visible from the browser, but only
in source view) as a HTML comment.
I've found a JavaScript that does this here:
http://www.twohootssoftware.co.uk/code/loadtimejs.html
<script language="javascript" type="text/javascript">
var now = new Date();
var startTime = now.getTime()
</script>
<!-- <html>
...... put your code here.....
</html>
//-->
<script language="javascript" type="text/javascript">
now = new Date();
var endTime = now.getTime();
alert("Time taken to load page : " + ((endTime - startTime)/1000)+"
seconds");
</script>
Except that it puts the time in a popup window. I tried changing the code
to print the value as 'document.write' instead of 'alert' but I can't get
this code to stay hidden in the browser and only visible within the HTML
source code.
Can someone let me know how I can alter the above script to do this?
Thanks,
Ste