PerformanceNavigationTiming: activationStart property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.
TheactivationStart read-only property represents the time between when a document starts prerendering and when it is activated.
In this article
Value
ADOMHighResTimeStamp representing the duration between document prerendering start and activation in milliseconds.
The value is0 if the page has not prerendered or is still prerendering.
Examples
>Detecting prerendered pages
When a prerendered document is activated,activationStart is set to the current time. The following function can check whether a page isprerendering or has already prerendered:
function pagePrerendered() { return ( document.prerendering || self.performance?.getEntriesByType?.("navigation")[0]?.activationStart > 0 );}Measuring user-perceived performance milestones
With prerendered pages, a page may have been created long before it was actually navigated to. When using thePerformance API on prerendered pages, it is vital to compare returned values withactivationStart in order to avoid misleading measurements.
// Time to when activation occurredlet activationStart = performance.getEntriesByType("navigation")[0].activationStart;// Time to first paintlet firstPaint = performance.getEntriesByName("first-paint")[0].startTime;// Time to first contentful paintlet firstContentfulPaint = performance.getEntriesByName( "first-contentful-paint",)[0].startTime;console.log(`time to first paint: ${firstPaint - activationStart}`);console.log( `time to first-contentful-paint: ${firstContentfulPaint - activationStart}`,);Specifications
| Specification |
|---|
| Prerendering Revamped> # performance-navigation-timing-extension> |