What is Speculation Rules Generator?
Speculation Rules are a JSON-based browser feature that lets you tell the browser which pages to prefetch or prerender before the user clicks. Prerendering loads the full page for instant navigation, while prefetching fetches only the document resource. This can make a static site feel fast because subsequent page views load from cache or pre-rendered state.
Quick answer
Speculation Rules use JSON to tell Chrome and Edge which pages to prefetch or prerender before the user clicks. Prerender loads the full page for instant navigation; prefetch fetches only the main document.
Limitations
- Speculation Rules only work in Chrome and Edge. Other browsers ignore the script tag entirely.
- Eager prerendering of many pages can waste significant bandwidth and memory, especially on mobile devices.
- Cross-origin prerendering has strict privacy constraints. Browsers may strip cookies and storage access from cross-origin prerendered pages.
How to use this tool
- Choose whether to prerender pages (full render) or prefetch them (document fetch only).
- Select the URL list source to specify exact pages, or document rules for pattern-based matching.
- Set the eagerness level. Conservative fires on hover or focus, moderate adds a short delay, eager fires immediately.
- Copy the script tag into your page head or near the end of body.
What you can use it for
- Prerender top navigation pages so they open instantly when clicked.
- Prefetch blog article pages from a listing to speed up reading flow.
- Add speculation rules to a documentation site so section pages load faster.