PerformanceNavigationTiming: criticalCHRestart property
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
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, but wasn't, included in the HTTP request initially sent. If the browser does not support that client hint, it is ignored and no connection restart occurs.
The criticalCHRestart
read-only property represents the time at which the connection restart occurred.
Value
A DOMHighResTimeStamp
representing the number of milliseconds elapsed since PerformanceEntry.startTime
when the connection restart occurred in milliseconds.
If the value is 0
the connection was not restarted.
Examples
Detecting connection restart pages
The following JavaScript can be used to see if the connection was restarted:
const restartTime =
performance?.getEntriesByType?.("navigation")[0]?.criticalCHRestart;
if (restartTime > 0) {
console.log("Time at which connection restart happened:", restartTime);
}
Specifications
Specification |
---|
Navigation Timing Level 2 # dom-performancenavigationtiming-criticalchrestart |
Browser compatibility
BCD tables only load in the browser