Speculation Rules API

The Speculation Rules API is a browser API, available in Chrome from version 109 (January 2023), that allows developers to declaratively define rules for speculatively prefetching or prerendering URLs the user is likely to navigate to next. Rules are defined as a JSON object embedded in a <script type="speculationrules"> tag or delivered via an HTTP response header. The API supports two actions — prefetch and prerender — and allows targeting by URL list, CSS selector matching links on the page, or eagerness level (immediate, eager, moderate, conservative). Prerender goes further than prefetch by fully loading and executing the page in a hidden background tab, so the navigation appears instant. The API replaces and improves upon the older <link rel="prerender"> hint, which had limited browser support and was effectively deprecated. In 2024, Google began factoring prerendering via Speculation Rules into its Chrome UX Report field data, meaning faster navigations directly benefit Core Web Vitals scores for multi-page sites.