title: Page load time with JavaScript
body: <p>I am looking for a proper way to test the time it takes a page to fully load all its resources. What I've done so far is add:</p>
  
  <pre><code>window.startTime = (new Date).getTime(); // after the title in my page
  </code></pre>
  
  <p>And </p>
  
  <pre><code>window.onload = function () {
      console.log((new Date).getTime() - window.startTime);
  }
  window.addEventListener('load',function () {
      console.log((new Date).getTime() - window.startTime);   
  },false);
  </code></pre>
  
  <p>Way down in the footer. Is this a good way to measure? 
  Could there be differences between load time and perceived load time? From what I'm seeing the events trigger after all the resources have loaded including images.
  Are there any differences between the two events? Also can I use PageSpeed to test this? (I know I can do it in chrome dev tools, but I also want a script so that I can keep track of data.)</p>