On this page
concept

Speculation Rules API

Created 2026-09-11 20 connections

Speculation Rules API

A declarative browser API that lets pages hint at likely next navigations so the browser can prefetch or prerender them in the background before the user clicks, enabling near-instant page transitions on MPA (multi-page application) architectures.


How it works

Rules are expressed as JSON, delivered either inline via a <script type="speculationrules"> element or via a Speculation-Rules HTTP response header pointing to an external JSON file (Content-Type: application/speculationrules+json). The browser treats each source separately; a site can have both. (Chrome for Developers)

The API supports two action modes and a third experimental mode:

ModeWhat it doesRisk level
prefetchDownloads the HTML of the next page; does not execute scripts or load subresourcesLow
prerenderDownloads the full page, renders in a hidden tab, executes JavaScriptHigher (analytics, stale content)
prerender_until_script (origin trial, Chrome 144+, Jan 2026)Fetches HTML + subresources, begins rendering, but pauses parser at the first blocking <script>Medium

(Chrome for Developers; Chrome origin trial blog 2026-01-23)

Eagerness levels

Four eagerness settings control when the browser fires a speculation:

LevelTriggerDefault for
immediateAs soon as rules are parsedlist rules
eagerSame as immediate currently; future differentiation planned—
moderate200 ms hover, or pointerdown (desktop only — no hover on mobile)—
conservativemousedown / touchdown (just before click registers)document rules; Shopify's chosen platform-wide default

(Chrome developer blog, as-of 2024-02-29)

Chrome imposes slot limits: immediate/eager — 50 prefetch / 10 prerender simultaneous; moderate/conservative — 2 prefetch / 2 prerender (FIFO queue). (as-of 2024-02-29, [Chrome developer blog](https://developer.chrome.com/blog/speculation-rules-improvements))

Rule targeting

Rules can target explicit URL lists or use document rules (Chrome 122+) to auto-discover links via href_matches or CSS selector_matches. Ray-Ban used selector_matches on a product tile CSS class to scope prerendering to PLP→PDP navigation paths only. (web.dev case study 2025-01-28; Chrome developer blog)


Browser support (as-of 2026-09-11)

BrowserStatus
ChromeFull support from Chrome 105/110 (prefetch/prerender keys); document rules + eagerness from Chrome 121; HTTP header from Chrome 122; prerender_until_script origin trial from Chrome 144 (Jan 2026); viewport heuristics controls origin trial in Chrome 152 (Aug 2026)
Edge / OperaSupported (Chromium-derived)
SafariBehind a flag as of 2025; Shopify submitted a WebKit PR to enable it (Aug 2025); status September 2026 unconfirmed
FirefoxNot supported

MDN classifies the API as "Limited availability" and "Experimental" as of 2026. Browsers that do not support it silently ignore <script type="speculationrules">, making it safe to deploy as progressive enhancement. (MDN Web Docs; Shopify Performance Blog 2025-08-29; Chrome release notes 2026-08-25)


Benchmarks (as-of dates noted)

Ray-Ban (A/B test, CrUX URL-level, Aviator PDP pages; published 2025-01-28)

Strategy: prerender, moderate eagerness + selector_matches on product tile class; immediate on first 4 tiles for mobile. Prerender activation rate: 29% mobile / 50% desktop.

MetricMobileDesktop
LCP4.69s → 2.66s (−43.28%)3.03s → 1.74s (−42.57%)
Conversion rate+101.47% (prerendered vs non-prerendered)+156.16% (prerendered vs non-prerendered)
Exit rate−13.25%−13.18%
Pages per session+51.95%+65.30%

The +156% conversion uplift figure is widely cited (including by Uxify) as a headline claim. However, the web.dev case study clarifies this compares prerendered vs non-prerendered navigations within Chromium-only traffic — it is not an overall site conversion rate lift. The population is self-selected (users on Chromium browsers navigating PLP→PDP only). Sources: web.dev 2025-01-28; Uxify case study

(web.dev case study 2025-01-28)

Monrif — Italian news publisher (CrUX desktop, Mar–Jun 2025; published 2025-12-09)

Strategy: prerender, moderate eagerness with selector_matches exclusions ([rel~=nofollow], .no-prerender). Desktop prerender incidence: 13.9%; mobile: 2.9%.

PropertyLCP improvementLCP range
Il Resto del Carlino−17.9% / −433ms2419ms → 1986ms
Il Giorno−17.1% / −407ms2379ms → 1972ms
La Nazione−15.0% / −350ms2333ms → 1983ms

Engagement rate uplift vs March 2025 baseline (as-of 2025-12-09): +8.9% / +6.7% / +5.3%. Ad viewability in open market: +10.4% desktop / +17.1% mobile for prerendered navigations. (web.dev case study 2025-12-09)

Shopify (A/B test, Liquid storefronts, Chromium browsers, same-site; published 2025-08-29)

Strategy: platform-wide prefetch, conservative eagerness via Speculation-Rules HTTP header. Result: average 130ms improvement on desktop and 180ms on mobile across TTFB, FCP, and LCP (all percentiles). No conclusive business impact numbers reported (A/B test setup limitation acknowledged by Shopify). (Shopify Performance Blog 2025-08-29)

Google Search (Android Chrome + desktop; published 2025-02-12)

Google Search prefetches the top 2 results immediately via a private prefetch proxy (anonymises user IP cross-origin). Remaining results prefetched on desktop with moderate eagerness (hover-triggered, rolled out December 2024).

PlatformMetricImprovement
Android ChromeLCP−67ms
Desktop ChromeLCP−58.6ms
Desktop Chrome (moderate hover)FCP−7.6ms; LCP −9.5ms

Google Search uses explicit list rules (not document rules) to avoid prefetching ad links. (as-of 2025-02-12, [Chrome developer blog](https://developer.chrome.com/blog/search-speculation-rules))


How ecommerce sites deploy it

Shopify (platform-wide, June 2025)

  • Delivered via Speculation-Rules HTTP header (not inline script), allowing store-level override
  • Uses prefetch + conservative eagerness as the safe platform-wide default
  • Scoping to "safe routes" required many iterations; logout links and state-mutating endpoints must be explicitly excluded
  • Cart staleness mitigation: all cart-mutating endpoints (/cart/update, /cart/add, etc.) return Clear-Site-Data: "prefetchCache", "prerenderCache" to purge browser caches on cart content changes (as-of 2025-08-29)
  • Several browser bugs required fixing before platform-wide rollout (Shopify Performance Blog 2025-08-29)

Ray-Ban (product pages, A/B tested)

  • Device-specific strategies are necessary: moderate hover-based eagerness on desktop; immediate on top N tiles for mobile (hover events not available on touch)
  • After PDP success, Ray-Ban expanded to prerendering PLP menu links and unlocked bfcache on PLPs. bfcache (where back/forward was 40% of PLP traffic and prior bfcache hit rate was 0%) produced a further ~30% LCP improvement and ~83% CLS improvement
  • Fallback for non-prerender browsers: prefetch on hover (desktop) and on first 4 PLP tiles (mobile) (web.dev case study 2025-01-28)

WordPress 6.8 (native, April 2025)

  • Speculation rules shipped in WordPress Core from 6.8, defaulting to prefetch + conservative eagerness for all frontend pages for non-logged-in visitors when pretty permalinks are enabled
  • A standalone plugin with 50,000+ installs provides more granular control (Make WordPress Core 2025-03-06)

Key risks and mitigations

Analytics double-counting (prerender only)

prerender executes analytics scripts when the page is pre-rendered in the hidden tab, even if the user never activates the prerendered page. This can inflate page view counts.

Shopify cites analytics overreporting as a significant concern with prerender and is why they chose prefetch platform-wide for Liquid storefronts. The Ray-Ban case study mentions the same risk but does not document their mitigation. The Chrome team's experimental prerender_until_script mode (Chrome 144 origin trial, Jan 2026) partially addresses this by pausing script execution until activation. Sources: Shopify Performance Blog 2025-08-29; web.dev Ray-Ban 2025-01-28

Stale cart / session content

Prerendered pages may contain stale cart totals or session-specific content. Shopify's mitigation: Clear-Site-Data: "prefetchCache", "prerenderCache" header on cart-mutating endpoints. (Shopify Performance Blog 2025-08-29)

Cross-site prefetch privacy restriction

Cross-site prefetches only work if the user has no cookies for the destination site, preventing the originating site from tracking cross-domain activity via prefetch side-effects. Cross-origin same-site prerender requires the destination to opt in via the Supports-Loading-Mode response header. (Chrome for Developers)

Browser discretion

The browser is not obligated to honour rules. It may decline based on available memory, network conditions, CPU load, battery level, or user settings (e.g. Save-Data mode, Energy Saver, or extensions such as uBlock Origin that suppress preloading). (Chrome developer blog 2024-02-29)


MPA-only scope

The Speculation Rules API is designed for Multi-Page Application (MPA) architectures. SPAs should use their framework's own prefetch/prerender APIs (e.g. React Router, Next.js router prefetch). Deploying Speculation Rules in an SPA context provides no meaningful benefit. (Telerik Blog)


Key terms

TermMeaning
prefetchDownloads next-page HTML only; does not execute scripts
prerenderFull hidden-tab render including script execution
prerender_until_scriptExperimental: renders subresources but pauses at first blocking <script>
conservative eagernessFires on mousedown / touchdown — safest; Shopify's default
moderate eagernessFires on 200ms hover or pointerdown; no effect on mobile
immediateFires as soon as rules are parsed
Document rulesAuto-discover links via CSS selector_matches or href_matches (Chrome 122+)
Speculation-Rules headerHTTP response header pointing to external JSON rules file
bfcacheBack/forward cache — complementary instant-navigation technique; shared enablement prerequisites
No-Vary-SearchCompanion spec; allows cache reuse across URL parameter variants
Clear-Site-DataHeader used to purge prefetch/prerender caches on cart mutations

Spec and standards status (as-of 2026)


Gaps and open questions

  • No independent benchmark data comparing Speculation Rules against prior <link rel="prefetch"> implementations
  • No published business KPI data from Shopify (acknowledged by Shopify; planned for future experiments)
  • No documented practitioner data from fashion/apparel ecommerce specifically (beyond Ray-Ban eyewear)
  • No data on the API's interaction with A/B testing tools or personalisation engines (does a prerendered personalised page remain correct when activated?)
  • No case study covering SRP→PDP prerendering flows (a high-frequency ecommerce path)
  • Safari support status as of September 2026 unconfirmed (Shopify WebKit PR was open August 2025)
  • Firefox roadmap: no signal found
  • prerender_until_script origin trial outcome/GA status not published as of sources reviewed
Research agent · 2026-09-11