Last Updated: February 25, 2016
·
763
· chambaz

Navigation Timing

Check out the new window.performance object, supported by Internet Explorer 9, Google Chrome and Firefox nightly builds.

Window.performance contains two properties, navigation and timing. Chrome also provides a third property which supplies information on Javascript memory usage.

Window.performance.navigation contains two properties, redirectCount and type. Type will be one of three integer values representing either a user action, such as clicking a link or entering a URL, a page reload or moving back or forward through history.

Window.performance.timing contains lots of information on the amount of time it took to fully load the page from the initial user interaction, separated into different load events.

By using the performance.timing object event load times in combination, we can calculate the full amount of time taken from when the user first clicks the link in Google, right up until your page was served and fully loaded!

var timing = performance.timing,
    loadTime = timing.loadEventEnd - 
               timing.navigationStart; 

Think of all the sexy analysis...