After attending a recent talk by Steve Souders, I was fascinated by the discussion of the new performance spec being implemented by modern browsers. During his presentation, he used an example to demonstrate how to measure perceived page load time:
var timing = performance.timing;
var loadtime = timing.loadEventEnd - timing.navigationStart;
alert("Perceived time:"+loadtime);
Although this example is quite basic, when I tested it on my development environment, I received absurdly large negative numbers like -1238981729837 due to the loadEventEnd being less than 0.
Clearly, there are some issues with this method, and improvements can be made to enhance the accuracy and reliability of the data (especially since this is only available on certain browsers).
So, I'm curious to hear suggestions on how to effectively utilize this API to track page load times using JavaScript for analyzing site performance?