Most of the wait after a click is the browser fetching and rendering the next page. The Speculation Rules API lets a web page name the pages a visitor is likely to open next, so the browser can fetch them, or fully render them, in the background before the click. When the click comes, the page is already there.
You write the rules as JSON inside a <script type="speculationrules"> element, or serve them from a separate file named in a Speculation-Rules HTTP header. The API is built for multi-page sites, where each click loads a new document. It doesn't help route changes inside a single-page app (MDN).
Prefetch or prerender
The API offers two levels of preloading:
| Prefetch | Prerender | |
|---|---|---|
| What the browser does | Downloads the page's HTML only | Downloads the page and everything it needs, runs its JavaScript and renders it in a hidden tab |
| Speed on click | Faster than normal | Near-instant |
| Cost if the visitor never clicks | Small: one download | Larger: about as much as rendering an iframe |
| Risk | Low | Higher, because the page's scripts run before anyone sees it |
MDN suggests prefetching broadly and prerendering sparingly, for pages the visitor is very likely to open next. The API is an alternative to prefetch links for documents and the successor to the Chrome-only <link rel="prerender">, which Chrome is retiring. For other resource hints, such as preloading a font, you still use <link> tags.
What a rule looks like
This rule prerenders any same-site link when the visitor holds the pointer over it, except the sign-out link and links marked with a no-prerender class:
<script type="speculationrules">
{
"prerender": [{
"where": {
"and": [
{ "href_matches": "/*" },
{ "not": { "href_matches": "/logout" } },
{ "not": { "selector_matches": ".no-prerender" } }
]
},
"eagerness": "moderate"
}]
}
</script>
Rules come in two kinds. List rules name exact URLs ("urls": ["/next-page"]). Document rules, like the one above, use where conditions to match links on the current page. Older examples include a "source" key; Chrome has inferred it since Chrome 121, so you can leave it out.
Eagerness: when the browser starts
The eagerness setting decides how strong a sign of intent the browser waits for. In Chrome (Chrome for Developers):
| Setting | When Chrome starts loading |
|---|---|
immediate |
As soon as it reads the rule |
eager |
On desktop, after the pointer rests on a link for 10 milliseconds; on mobile, shortly after a link scrolls into view |
moderate |
On desktop, after 200 milliseconds of hovering or on pointer down; on mobile, based on where the visitor stops scrolling |
conservative |
When the visitor presses on the link |
List rules default to immediate, document rules to conservative. Until Chrome 143, eager behaved like immediate, so older guides describe it that way.
Limits and browser support
Chrome caps speculation to protect visitors' data and memory. With immediate, a page can have up to 50 prefetches and 10 prerenders. With the other settings, Chrome keeps at most 2 of each and drops the oldest when a new one starts. Chrome also skips speculation when Save-Data or Energy Saver is on, prerenders only if the visitor's "Preload pages" setting is enabled, and treats every rule as a hint it may ignore.
As of 2026-10-22, the API works in Chromium-based browsers: Chrome, Edge, Opera and Samsung Internet. Firefox supports it only in preview builds, for prefetching listed URLs, and Safari 26.2 has it behind a setting that's off by default (MDN). Other browsers ignore the rules, so adding them doesn't break anything. MDN still marks the API experimental, so expect details to change.
Some rules also limit where speculation can go. Prerendering works for same-origin pages by default; cross-site prerendering isn't possible. Cross-site prefetches work only if the visitor has no cookies for the other site.
What to watch out for
- Links that do something. A prefetch is a real GET request. Exclude URLs that sign people out, switch languages, add to a cart, send a one-time code, count against a usage allowance or record an ad conversion.
- Analytics. A prerendered page that's never opened shouldn't count as a page view. Google Analytics waits until the page is shown, but check other scripts. In your own code,
document.prerenderingand theprerenderingchangeevent tell you when the page is actually displayed. - Stale or personal content. A page loaded in advance can be out of date by the time it's shown, for example a cart that's missing the item just added. Update such pages on activation, or clear speculations with the
Clear-Site-Dataheader. Chrome keeps a prefetched page for up to 5 minutes. - Content Security Policy. If your site uses one, allow the rules in
script-srcwith'inline-speculation-rules', a hash or a nonce. - Server load. Requests carry a
Sec-Purpose: prefetchheader (prefetch;prerenderfor prerenders), so you can spot them in logs. Any response that isn't a 2xx success code cancels the speculation.
What it means for Core Web Vitals
For a prerendered page, Largest Contentful Paint is measured from the moment the visitor opens the page, not from when the browser started loading it (web.dev). A page that was fully rendered before the click can therefore show a very short LCP in field data, the measurements from real visits. The gain applies only to visits that start from a page with your rules, such as clicks between pages on your site.
To check that your rules work, open Chrome DevTools, go to the Application panel and find Speculative loads under Background services. It lists the rules on the page and every URL that was prefetched or prerendered.