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?


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.


If you need the same level of information that you get using window.performance I think that the answer is NOT .

In the w3.org spec of XMLHttpRequest you only find a list of events, using that you could get some times, but not the same detail of network times.

Maybe you can look for something similar to Firebug-NetPanel, which is using a XPCOMInterface nsIHttpActivityObserver

链接地址: http://www.djcxy.com/p/59004.html

上一篇: 在运行时更改R函数的默认参数

下一篇: XMLHttpRequests上有可用的NavigationTiming接口吗?