What loads
- Prefetch
- The document response body only
- Prerender
- The full page, subresources and scripts
Speculation rules tell the browser which pages to prefetch or prerender before a click. Syntax, eagerness levels, Chrome limits, and how to check them.
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.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
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.
prerender (or prefetch)whereurls in the same rulehref_matches* wildcardsselector_matchesnot, and, oreagernessconservative to immediate<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.
conservativemoderateeagerimmediate| 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 pages setting is off, and in background tabs. Measure with real users, because your own lab machine is rarely in these states.
inline-speculation-rules in script-src, together with a hash or nonce. See content security policy.eager acts like immediate for list rules in current implementations, per MDN. Use document rules when you want hover-style triggers.Run the snippet above. A SyntaxError means the JSON is invalid and, per MDN, no rules apply.
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.
Compare pageviews before and after rollout. A jump that doesn't match real traffic suggests tags firing during prerender.
// 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));2 questions people ask next, answered from the sources on this page.
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.
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.
The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.