PerformanceNavigationTiming

这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。

PerformanceNavigationTiming 提供了用于存储和检索有关浏览器文档事件的指标的方法和属性。 例如,此接口可用于确定加载或卸载文档需要多少时间。

属性

该接口扩展了 PerformanceEntry 属性,修订和约束以下性能条目:

PerformanceEntry.entryType 只读
返回 "navigation".
PerformanceEntry.name 只读
返回 文档地址.
PerformanceEntry.startTime 只读
返回值为0的 DOMHighResTimeStamp
PerformanceEntry.duration 只读
返回 timestamp 值,即 PerformanceNavigationTiming.loadEventEndPerformanceEntry.startTime 属性之间的差值。

该接口还扩展 PerformanceResourceTiming 属性,修订和约束以下性能条目:

PerformanceResourceTiming.initiatorType只读
返回 "navigation".

该接口还支持以下属性:

PerformanceNavigationTiming.domComplete 只读  
一个 DOMHighResTimeStamp 时间值,等于浏览器将当前文档的当前文档准备就绪之前的时间。
PerformanceNavigationTiming.domContentLoadedEventEnd 只读
一个 DOMHighResTimeStamp 时间值,等于当前文档的 DOMContentLoaded 事件完成后的时间。
PerformanceNavigationTiming.domContentLoadedEventStart 只读
一个 DOMHighResTimeStamp 时间值,等于用户代理在当前文档上触发 DOMContentLoaded 事件之前的时间。
PerformanceNavigationTiming.domInteractive 只读  
一个 DOMHighResTimeStamp 时间值,等于用户代理将当前文档的当前文档准备就绪设置为交互之前的时间。
PerformanceNavigationTiming.loadEventEnd 只读  
一个 DOMHighResTimeStamp 时间值,代表当前文档的加载事件完成的时间。
PerformanceNavigationTiming.loadEventStart 只读  
一个 DOMHighResTimeStamp 时间值,等于立即触发当前文档的加载事件之前的时间。
PerformanceNavigationTiming.redirectCount 只读  
表示自当前浏览上下文中上次非重定向导航以来的重定向次数的数字。
如果没有重定向,或者重定向是从另一个 origin 发的,并且该 origin 不允许将其计时信息公开给当前来源,则该值为0。
PerformanceNavigationTiming.requestStart 只读  
返回一个 DOMHighResTimeStamp 时间值,代表 UA 立即开始从服务器,相关应用程序缓存或本地资源请求资源之前的时间。
PerformanceNavigationTiming.responseStart 只读  
一个 DOMHighResTimeStamp 时间值,代表用户代理的HTTP解析器从相关应用程序缓存,本地资源或服务器接收到响应的第一个字节后立即的时间。
PerformanceNavigationTiming.type 只读  
一个 string 表示导航类型,取值为为:“navigate”,“reload”,“back_forward”或“prerender”。
PerformanceNavigationTiming.unloadEventEnd 只读  
一个 DOMHighResTimeStamp 时间值,等于用户代理程序完成前一文档的卸载事件之后的时间。
PerformanceNavigationTiming.unloadEventStart 只读  
一个 DOMHighResTimeStamp 时间值,等于用户代理程序开始前一个文档的卸载事件之前的时间。

方法

PerformanceNavigationTiming.toJSON()
返回一个表示PerformanceNavigationTiming对象的DOMString JSON。

规范

规范 状态 注释
Navigation Timing Level 2
PerformanceNavigationTiming
Working Draft Initial definition.

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
PerformanceNavigationTiming
Experimental
Chrome Full support 57Edge Full support 12Firefox Full support 58
Notes
Full support 58
Notes
Notes You can disable this feature using the dom.enable_performance_navigation_timing preference (see bug 1403926).
IE No support NoOpera Full support 44Safari No support NoWebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 58
Notes
Full support 58
Notes
Notes You can disable this feature using the dom.enable_performance_navigation_timing preference (see bug 1403926).
Opera Android Full support 43Safari iOS No support NoSamsung Internet Android Full support 7.0
domComplete
Experimental
Chrome Full support 57Edge Full support 12Firefox Full support 58IE No support NoOpera Full support 44Safari No support NoWebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 58Opera Android Full support 43Safari iOS No support NoSamsung Internet Android Full support 7.0
domContentLoadedEventEnd
Experimental
Chrome Full support 57Edge Full support 12Firefox Full support 58IE No support NoOpera Full support 44Safari No support NoWebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 58Opera Android Full support 43Safari iOS No support NoSamsung Internet Android Full support 7.0
domContentLoadedEventStart
Experimental
Chrome Full support 57Edge Full support 12Firefox Full support 58IE No support NoOpera Full support 44Safari No support NoWebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 58Opera Android Full support 43Safari iOS No support NoSamsung Internet Android Full support 7.0
domInteractive
Experimental
Chrome Full support 57Edge Full support 12Firefox Full support 58IE No support NoOpera Full support 44Safari No support NoWebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 58Opera Android Full support 43Safari iOS No support NoSamsung Internet Android Full support 7.0
loadEventEnd
Experimental
Chrome Full support 57Edge Full support 12Firefox Full support 58IE No support NoOpera Full support 44Safari No support NoWebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 58Opera Android Full support 43Safari iOS No support NoSamsung Internet Android Full support 7.0
loadEventStart
Experimental
Chrome Full support 57Edge Full support 12Firefox Full support 58IE No support NoOpera Full support 44Safari No support NoWebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 58Opera Android Full support 43Safari iOS No support NoSamsung Internet Android Full support 7.0
redirectCount
Experimental
Chrome Full support 57Edge Full support 12Firefox Full support 58IE No support NoOpera Full support 44Safari No support NoWebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 58Opera Android Full support 43Safari iOS No support NoSamsung Internet Android Full support 7.0
toJSON
Experimental
Chrome Full support 57Edge Full support ≤18Firefox Full support 58IE No support NoOpera Full support 44Safari No support NoWebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 58Opera Android Full support 43Safari iOS No support NoSamsung Internet Android Full support 7.0
type
Experimental
Chrome Full support 57Edge Full support 12Firefox Full support 58IE No support NoOpera Full support 44Safari No support NoWebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 58Opera Android Full support 43Safari iOS No support NoSamsung Internet Android Full support 7.0
unloadEventEnd
Experimental
Chrome Full support 57Edge Full support 12Firefox Full support 58IE No support NoOpera Full support 44Safari No support NoWebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 58Opera Android Full support 43Safari iOS No support NoSamsung Internet Android Full support 7.0
unloadEventStart
Experimental
Chrome Full support 57Edge Full support 12Firefox Full support 58IE No support NoOpera Full support 44Safari No support NoWebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 58Opera Android Full support 43Safari iOS No support NoSamsung Internet Android Full support 7.0

Legend

Full support  
Full support
No support  
No support
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
See implementation notes.
See implementation notes.

参见