<script type="text/javascript">//<![CDATA[
// jQuery has already been loaded but this could be equivalent to
// a function in <body onLoad="">
$(function(){
var iNavStart=performance.timing.navigationStart;
var iNavEnd=performance.timing.loadEventEnd;
var iPageLoad=iNavEnd-iNavStart;
console.dir({'iNavStart',iNavStart});
console.dir({'iNavEnd',iNavEnd});
console.dir({'iPageLoad',iPageLoad});
});
//]]</script>
When the page loads, the console reveals:
iNavStart: 1449594976150
iNavEnd: 0
iPageLoad: -1449594976150
I was expecting this calculation to give me a nice number of milliseconds. Surely iNavEnd shouldn't be 0?
Tested in Chrome 47 and Firefox 42 (both support performance.timing).
Any ideas where I'm going wrong?