Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

page load time with Jquery

I want to calculate the page load time; This means from second 0 (a little jquery snippet was loaded) to second x, when the whole page is loaded.

i wonder if any one had an experience with it, also ideas how to implement it correctly will be apperciated.

please i don't need an extension, i already have firebug, i need a js solution

thanks :)

like image 246
Omar Abid Avatar asked Jul 31 '09 08:07

Omar Abid


1 Answers

Since scripts execute as soon as they are parsed, I suggest that you put one script tag just inside the header, then the script to hook the page load event after you've loaded jQuery:

<html>
<head>
   <script>
      // Capture start time
   </script>
   ...
   <script src="jquery.js" />
   <script>
      $(window).load(function() {
         // Capture end time
      });
   </script>
...

That way you should be able to catch as much of the page load time as possible.

like image 65
Kothar Avatar answered Oct 05 '22 11:10

Kothar