How Chromium’s Prerender2.0 Boosts Page Load Speed: Architecture, API, and Implementation Guide
This article explains Chromium's Prerender2.0—its reintroduction in M94, the underlying MPArch multi‑page architecture, the Speculation Rules API usage, activation detection methods, detailed implementation flow in M97, and practical scenarios for safely applying prerender to improve web performance.
1. Introduction
Prerender loads and parses a page before navigation, enabling near‑instant display when the user finally opens the page. Chromium originally offered Prerender 1.0 (2011‑2018) via <link rel="prerender" href="/next-page/">, but it was deprecated because of high resource consumption.
2. Prerender 2.0 Overview
From Chromium M94 the feature was re‑implemented as Prerender 2.0. It uses a single WebContents (the Multi‑Page Architecture, MPArch) to host multiple pages, reducing memory usage compared with the previous multi‑WebContents model.
2.1 MPArch
MPArch allows one WebContents to manage several visible or hidden pages. This design aligns with Back‑Forward Cache (BFCache) and enables efficient prerendering.
3. Using Prerender 2.0
3.1 Speculation Rules API
Prerender 2.0 is triggered by the Speculation Rules API. The specification is hosted at
https://github.com/WICG/nav-speculation/blob/main/triggers.md#speculation-rules. Browser support can be queried with: HTMLScriptElement.supports('speculationrules') Example rule script:
<script type="speculationrules">
{
"prerender": [
{"source":"list","urls":["next.html","./PrefetchTestNew.html"]}
],
"prefetch": [
{"source":"list","urls":["next.html"],"requires":["anonymous-client-ip-when-cross-origin"]}
],
"prefetch_with_subresources": [
{"source":"list","urls":["next.html"],"requires":["anonymous-client-ip-when-cross-origin"]}
]
}
</script>Key fields:
prerender – full page rendering and script execution.
prefetch – only the main document is fetched.
prefetch_with_subresources – main document plus critical sub‑resources (similar to NoState Prefetch).
requires – currently only anonymous-client-ip-when-cross-origin, usable with prefetch actions.
3.2 Detecting activation
When a prerendered page becomes the active navigation, the following can be used to confirm activation:
Read
performance.getEntriesByType('navigation')[0].activationStart; a value > 0 indicates successful activation.
Listen for the prerenderingchange event.
// Method 1
let activationStart = performance.getEntriesByType('navigation')[0].activationStart;
// Method 2
let wasActivated = false;
document.addEventListener('prerenderingchange', () => {
wasActivated = true;
});3.3 Effect comparison
In Chromium’s demo video the page without prerender loads progressively, while the prerendered page appears almost instantly.
4. Implementation flow (Chromium M97)
4.1 Parsing speculation rules
The browser scans type="speculationrules" scripts, parses the JSON and extracts actions ( kPrefetch, kPrefetchWithSubresources, kPrerender) together with rule fields ( urls, requires). For a kPrerender action the engine checks:
The initiating page is visible.
The device has sufficient memory (low‑end devices are excluded).
Cross‑origin prerender is currently disallowed (planned for M109).
Only one prerender per page is allowed; duplicate requests are ignored.
4.2 Prerender host management
On the browser side a PrerenderHost object owns a single prerendered page and creates a FrameTree for it. All hosts are stored in a PrerenderHostRegistry keyed by frame_tree_node_id. The prerendered page starts invisible.
4.3 Navigation and activation
When the user clicks a link that matches a stored prerender, the navigation request looks up the PrerenderHostRegistry for a matching frame_tree_node_id. If found, the stored page’s state is switched to active. The browser still issues a network request for the first packet of the main document to verify that request and response headers match the prerendered copy. After validation, CommitNavigation swaps the stored page into the visible tab and moves the previous page into BFCache.
5. Application scenarios
Because prerender consumes noticeable device resources, it should be enabled only when the probability of a user visiting the target page is high. Typical uses include:
Search engines that embed custom predictors to prerender likely result pages.
Websites that statically embed prerender rules for high‑traffic pages or dynamically inject them based on user behavior.
Effectiveness can be measured by two metrics: the number of pages for which prerender was started, and the number of those pages that were actually activated ( activationStart > 0). The hit‑rate guides adjustments to the prerender strategy.
6. Summary
Prerender 2.0 replaces the legacy multi‑WebContents approach with a lightweight single‑WebContents model, offering faster page‑on‑screen performance while using less memory. The feature is driven by the Speculation Rules API, which also supports prefetch and NoState Prefetch actions. Developers should monitor browser support, evaluate hit‑rate metrics, and apply prerender conservatively to high‑probability navigation paths.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
