PerformanceNavigationTiming
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since October 2021.
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
.
The following diagram shows all of the timestamp properties defined in PerformanceNavigationTiming
.
Instance properties
This interface extends the following PerformanceEntry
properties by qualifying and constraining them as follows:
PerformanceEntry.entryType
Read only-
Returns
"navigation"
. PerformanceEntry.name
Read only-
Returns the document's URL. Note that text fragments, and any other fragment directives, are stripped from the URL.
PerformanceEntry.startTime
Read only-
Returns a
DOMHighResTimeStamp
with a value of0
. PerformanceEntry.duration
Read only-
Returns a
timestamp
that is the difference between thePerformanceNavigationTiming.loadEventEnd
andPerformanceEntry.startTime
properties.
This interface also extends the following PerformanceResourceTiming
properties by qualifying and constraining them as follows:
PerformanceResourceTiming.initiatorType
Read only-
Returns
"navigation"
.
The interface also supports the following properties:
-
A
DOMHighResTimeStamp
representing the time between when a document starts prerendering and when it is activated. -
A
DOMHighResTimeStamp
representing the time at which the connection restart occurred due toCritical-CH
HTTP response header mismatch. -
A
DOMHighResTimeStamp
representing the time immediately before the user agent sets the document'sreadyState
to"complete"
. -
A
DOMHighResTimeStamp
representing the time immediately after the current document'sDOMContentLoaded
event handler completes. -
A
DOMHighResTimeStamp
representing the time immediately before the current document'sDOMContentLoaded
event handler starts. -
A
DOMHighResTimeStamp
representing the time immediately before the user agent sets the document'sreadyState
to"interactive"
. -
A
DOMHighResTimeStamp
representing the time immediately after the current document'sload
event handler completes. -
A
DOMHighResTimeStamp
representing the time immediately before the current document'sload
event handler starts. -
A
NotRestoredReasons
object providing report data on reasons why the current document was blocked from using the back/forward cache (bfcache) on navigation. -
A number representing the number of redirects since the last non-redirect navigation in the current browsing context.
-
A string representing the navigation type. Either
"navigate"
,"reload"
,"back_forward"
or"prerender"
. -
A
DOMHighResTimeStamp
representing the time immediately after the current document'sunload
event handler completes. -
A
DOMHighResTimeStamp
representing the time immediately before the current document'sunload
event handler starts.
Instance methods
-
Returns a JSON representation of the
PerformanceNavigationTiming
object.
Specifications
Specification |
---|
Navigation Timing Level 2 # sec-PerformanceNavigationTiming |
Browser compatibility
BCD tables only load in the browser