# Speculation rules

> Speculation rules tell the browser which pages to prefetch or prerender before a click. Syntax, eagerness levels, Chrome limits, and how to check them.

Canonical: https://scaplet.com/glossary/speculation-rules

Glossary Glossary · Performance

Speculation rules tell the browser which pages to prefetch or prerender before a click. Syntax, eagerness levels, Chrome limits, and how to check them.

3 min

read

2

sources

Nov 1, 2026

updated

Scaplet Editorial Team

author

In one line

Speculation rules are JSON, placed in a script tag of type speculationrules, that tell the browser which likely next pages to prefetch or prerender. A prerendered page loads fully in a hidden tab and is shown on click. The browser treats the rules as a hint, so it may decline to speculate.

30-second check

## Is this costing your site traffic?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?

Summarize this page with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fspeculation-rules%20(%22Speculation%20rules%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fspeculation-rules%20(%22Speculation%20rules%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fspeculation-rules%20(%22Speculation%20rules%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fspeculation-rules%20(%22Speculation%20rules%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

## At a glance

4 facts from the sources below

`speculationrules`

Script type

`prefetch`, `prerender`

Actions

`immediate`

List rule default

`conservative`

Document rule default

_01_At a glance

## Prefetch versus prerender

Chrome's documentation describes two actions. Prefetch downloads the next document and holds it in memory, without [rendering](/glossary/rendering) it. Prerender goes further: it loads the whole page, JavaScript included, in a hidden tab and shows it when the user navigates. Prerender costs more memory and bandwidth.

### What loads

Prefetch

The document response body only

Prerender

The full page, subresources and scripts

### Where it waits

Prefetch

In memory

Prerender

In a hidden tab

### Cost

Prefetch

Lower

Prerender

Higher memory and bandwidth

### Cross-site

Prefetch

Allowed with conditions (see gotchas)

Prerender

Not supported

Chrome calls this a hint and a progressive enhancement. Unsupported browsers ignore the script, so adding it costs nothing for them. Per Chrome's docs, Firefox doesn't support it and Safari has it behind a flag.

_02_At a glance

## Anatomy of a ruleset

Part

### `prerender` (or `prefetch`)

Job

Array of rules, one action per array

Part

### `where`

Job

A document rule: tests every link on the page. Cannot be combined with `urls` in the same rule

Part

### `href_matches`

Job

URL Pattern match on the link's href, with `*` wildcards

Part

### `selector_matches`

Job

CSS selector match, handy for opting links out with a class

Part

### `not`, `and`, `or`

Job

Combine conditions

Part

### `eagerness`

Job

How early the browser should act, from `conservative` to `immediate`

Prerender same-site links on moderate intent, skip logout

```
<script type="speculationrules"> { "prerender": [ { "where": { "and": [ { "href_matches": "/*" }, { "not": { "href_matches": "/logout" } }, { "not": { "selector_matches": ".no-prerender" } } ] }, "eagerness": "moderate" } ] } </script>
```

The JSON must be valid. MDN says invalid JSON throws a `TypeError`, and that the `src`, `async`, `defer` and a few other script attributes must not be set. A rule with a fixed list of pages uses `urls` instead of `where`.

_03_Eagerness values, per Chrome's documentation

## Eagerness and Chrome's limits

Value

### `conservative`

Trigger

Pointer or touch down on the link

Value

### `moderate`

Trigger

Desktop: after 200 ms of hover, or pointer down if sooner. Mobile: viewport heuristics

Value

### `eager`

Trigger

Desktop: after 10 ms of hover. Mobile: shortly after the link enters the viewport

Value

### `immediate`

Trigger

As soon as the rules are observed

Chrome's per-page limits
| Eagerness | Prefetch | Prerender |
| `immediate` | 50 | 10 |
| `eager` or `moderate`, mobile | 6, oldest dropped first | 2, oldest dropped first |
| `eager` or `moderate`, desktop | 2, oldest dropped first | 2, oldest dropped first |
| `conservative` | 2, oldest dropped first | 2, oldest dropped first |

Chrome also skips speculation under Save-Data, memory pressure, Energy Saver on low battery, when the [Preload](/glossary/preload) pages setting is off, and in background tabs. Measure with real users, because your own lab machine is rarely in these states.

_04_Checklist

## Gotchas before you ship it

First_2_
**CSP can block inline rules.** MDN says inline speculation rules need `inline-speculation-rules` in `script-src`, together with a hash or nonce. See [content security policy](/glossary/content-security-policy).

**Cross-site is restricted.** MDN says cross-site prerender isn't supported, and cross-site prefetch needs a strict enough referrer policy and a user with no cookies for the destination.

Next_1_
**`eager` acts like `immediate` for list rules** in current implementations, per MDN. Use document rules when you want hover-style triggers.

Then_1_
**Rules in subframes are ignored,** and rules in a prerendered page only apply after it is activated.

**Prerendered pages run your JavaScript**A prerendered page executes before the user sees it. Analytics, ad calls, and anything that assumes a visible page can fire for visits that never happen. Exclude logout, cart, and other state-changing URLs, as the example above does, and run view-dependent code after activation.

_05_How it works

## Check it in 2 minutes

1. 1

### Confirm the rules parse

Run the [snippet](/glossary/snippet) above. A `SyntaxError` means the JSON is invalid and, per MDN, no rules apply.
2. 2

### Look in Chrome DevTools

Chrome's docs say ruleset tags show in DevTools. The panel layout changes between versions, so check Chrome's current DevTools documentation for where speculation status appears.
3. 3

### Watch your analytics

Compare pageviews before and after rollout. A jump that doesn't match real traffic suggests tags firing during prerender.

DevTools console: feature detection and rule inspection

```
// true in browsers that understand the script type HTMLScriptElement.supports('speculationrules'); // print every ruleset on the page [...document.querySelectorAll('script[type=speculationrules]')] .map((s) => JSON.parse(s.textContent));
```

Questions

## Asked a lot.

2 questions people ask next, answered from the sources on this page.

_01_ Does speculation rules replace link rel=preload?

No. Preload fetches a resource the current page needs. Speculation rules fetch or render a whole next page. They solve different problems and can be used together. See [preload](/glossary/preload).

_02_ Which browsers support it?

Chrome's documentation lists Chrome and Edge as supporting it, Firefox as not supporting it, and Safari behind a flag. Because unsupported browsers ignore the script, it works as a progressive enhancement.

Sources · 2

## Every fact, linked and dated.

Official docs first. The date is when we last opened each page.

- chrome.com
- mozilla.org

1. 01 [Prerender pages in Chrome for instant page navigations](https://developer.chrome.com/docs/web-platform/prerender-pages) developer.chrome.com · checked 2026-11-01
2. 02 [script type=speculationrules (MDN)](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/speculationrules) developer.mozilla.org · checked 2026-11-01

## Keep learning

[All glossary](/glossary)

[Learn Content Security Policy Performance](/glossary/content-security-policy) [Related Largest Contentful Paint Performance](/glossary/largest-contentful-paint) [Read next Page speed Performance](/glossary/page-speed) [Do Run a free site audit Free, about two minutes](/site-audit)

Nearby in glossary
[SPA SEO](/glossary/spa-seo) [Google spam policies](/glossary/spam-policies) [Squeeze page](/glossary/squeeze-page)

More in Performance
[Lighthouse](/glossary/lighthouse) [Page experience](/glossary/page-experience) [Page speed](/glossary/page-speed) [PageSpeed Insights](/glossary/pagespeed-insights) [preconnect](/glossary/preconnect) [preload](/glossary/preload) [Progressive web app](/glossary/progressive-web-app) [Real user monitoring (RUM)](/glossary/real-user-monitoring) [Render-blocking](/glossary/render-blocking) [Responsive design](/glossary/responsive-design) [Responsive images](/glossary/responsive-images) [Service worker](/glossary/service-worker) [Speculation rules](/glossary/speculation-rules) [Speed Index](/glossary/speed-index) [SVG](/glossary/svg) [Synthetic monitoring](/glossary/synthetic-monitoring) [Time to First Byte (TTFB)](/glossary/time-to-first-byte) [Time to Interactive (TTI)](/glossary/time-to-interactive) [Total Blocking Time (TBT)](/glossary/total-blocking-time) [TTL (time to live)](/glossary/ttl) [Viewport meta tag](/glossary/viewport-meta-tag) [WebP](/glossary/webp) [AVIF](/glossary/avif) [bfcache (back/forward cache)](/glossary/bfcache)

Terms on this page
[Rendering](/glossary/rendering) [preload](/glossary/preload) [Content Security Policy](/glossary/content-security-policy) [Search snippet](/glossary/snippet)

Free · 2 minutes

## Know the term. _Now check your site._

The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **+212%** organic clicks in 90 days Ledgerly
