Navigation timing
The PerformanceNavigationTiming interface provides methods and properties to store and retrieve metrics regarding the browser's document navigation events. For example, this interface can be used to determine how much time it takes to load or unload a document.
Only the current document is included in the performance timeline, so there is only one PerformanceNavigationTiming object in the performance timeline. It inherits all of the properties and methods of PerformanceResourceTiming and PerformanceEntry.
PerformanceEntry PerformanceResourceTiming PerformanceNavigationTiming The following diagram shows all of the timestamp properties defined in PerformanceNavigationTiming.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 57 | 12 | 58 | 15 | 57 | 15.1 | |
criticalCHRestart Experimental A website can indicate that a particular Client Hint is critical to the page by including it in a Critical-CH HTTP response header (as well as the Accept-CH HTTP request header which is needed for all client hints whether critical or not). Doing so will trigger a connection restart if the hint listed in the Critical-CH HTTP response header could have been,… | 116 | 116 | | | 116 | |
| The domComplete read-only property returns a DOMHighResTimeStamp representing the time immediately before the user agent sets the document's readyState to "complete". | 57 | 12 | 58 | 15 | 57 | 15.1 |
| The domContentLoadedEventEnd read-only property returns a DOMHighResTimeStamp representing the time immediately after the current document's DOMContentLoaded event handler completes. | 57 | 12 | 58 | 15 | 57 | 15.1 |
| The domContentLoadedEventStart read-only property returns a DOMHighResTimeStamp representing the time immediately before the current document's DOMContentLoaded event handler starts. | 57 | 12 | 58 | 15 | 57 | 15.1 |
| The domInteractive read-only property returns a DOMHighResTimeStamp representing the time immediately before the user agent sets the document's readyState to "interactive". | 57 | 12 | 58 | 15 | 57 | 15.1 |
| The loadEventEnd read-only property returns a DOMHighResTimeStamp representing the time immediately after the current document's load event handler completes. | 57 | 12 | 58 | 15 | 57 | 15.1 |
| The loadEventStart read-only property returns a DOMHighResTimeStamp representing the time immediately before the current document's load event handler starts. | 57 | 12 | 58 | 15 | 57 | 15.1 |
| The redirectCount read-only property returns a number representing the number of redirects since the last non-redirect navigation in the current browsing context. | 57 | 12 | 58 | 15 | 57 | 15.1 |
| The toJSON() method of the PerformanceNavigationTiming interface is a Serialization; it returns a JSON representation of the PerformanceNavigationTiming object. | 57 | 16 | 58 | 15 | 57 | 15.1 |
| The type read-only property returns the type of navigation. | 57 | 12 | 58 | 15 | 57 | 15.1 |
| The unloadEventEnd read-only property returns a DOMHighResTimeStamp representing the time immediately after the previous document's unload event handler completes. | 57 | 12 | 58 | 15 | 57 | 15.1 |
| The unloadEventStart read-only property returns a DOMHighResTimeStamp representing the time immediately before the previous document's unload event handler starts. | 57 | 12 | 58 | 15 | 57 | 15.1 |
Use cases
-
Using Navigation timing
The PerformanceNavigationTiming interface provides methods and properties to store and retrieve metrics regarding the browser's document navigation events.
Cautions
- May not be supported in older browsers.
Implementation notes
- Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.