Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a NavigationTiming interface available on XMLHttpRequests?

The window.performance object exposes information about performance of the last page load done by the browser, including dns lookup times among others. However, I haven't been able to find anything similar for Ajax calls.

The higher-level problem I'm trying to solve is to be able to use Google Analytics to track load times. You can set custom events and track timing on javascript, but there is currently no way of getting lookup times, and other relevant performance data. Maybe there is a way to get this information from the XMLHttpRequest object?

like image 805
andresuribe Avatar asked Apr 18 '12 16:04

andresuribe


1 Answers

window.performance.timing -- defined in the W3C NavigationTiming specification, only exposes performance metrics of the root document's page load.

The W3C ResourceTiming specification, on the other hand, exposes performance information for all of the page's resources, such as img, script and XMLHttpRequest. ResourceTiming is implemented in IE10+ and is currently prefixed in Chrome.

like image 121
NicJ Avatar answered Oct 20 '22 04:10

NicJ