← Glossary·Web tech
Speculation Rules
A browser API for declaring which links to prefetch or prerender, so navigation feels instant on hover.
The Speculation Rules API is a `<script type="speculationrules">` block that tells the browser which URLs to speculatively prefetch (download HTML) or prerender (download and render the entire page) before the user actually navigates. The trigger can be eager (immediately on load), moderate (on hover or touchstart), or conservative (on click).
Well-tuned speculation can make in-app navigation feel essentially instant — by the time the user clicks, the destination is already painted. The downside is bandwidth and CPU usage on the client, so the rules should exclude auth-gated paths, infinite-scroll URLs, and anything that would be wasted to prerender.
Support is Chromium-only as of 2025. Browsers without support ignore the JSON entirely, so the cost of adding speculation rules is effectively zero — they only help where they help.
Specs & references