User Agents

Web browsers and everyday web tech, explained

Chrome Speculation Rules: Does Prefetch Happen?

· 6 min read · Browsers

In this article
  1. Background: What Are Speculation Rules?
  2. How Prefetching Works Under Speculation Rules
  3. How to Choose: Prefetch vs. Prerender
  4. Common Problems and Misconceptions
  5. Comparison: Speculation Rules vs. Old Prefetch Methods
  6. Safety and Privacy Considerations
  7. Alternatives to Speculation Rules
  8. Frequently Asked Questions

Yes, Chrome's speculation rules can trigger prefetching, but only when a page explicitly embeds a speculation rules JSON that opts into prefetch, and even then Chrome applies its own eligibility checks before fetching anything. Speculation rules are a relatively new API that lets a site tell Chrome which links are likely to be clicked next; Chrome may then prefetch (or prerender) those pages to make navigation instant. However, prefetching is not automatic — it requires the site to include the rules, and Chrome decides whether to act on them based on network conditions, user settings, and the page's own constraints.

Background: What Are Speculation Rules?

Speculation rules were introduced in Chrome 103 (mid-2022) as a replacement for the older, less flexible <link rel="prefetch"> and <link rel="prerender"> hints. The old hints were often ignored or deprecated because they were easy to misuse and could waste bandwidth. Speculation rules are a more structured way for a website to declare its navigation intentions.

The API works by embedding a JSON block in the page, typically inside a <script type="speculationrules"> tag. That JSON tells Chrome which URLs to prefetch or prerender, and under what conditions (e.g., only when the user hovers over a link, or always for certain links). Chrome then decides whether to act, based on its own heuristics and the user's settings.

How Prefetching Works Under Speculation Rules

When a site includes speculation rules that list a URL for prefetch, Chrome performs a low-priority fetch of that page's HTML and its subresources (like CSS and JavaScript) in the background. The fetched content is stored in the HTTP cache, but the page is not executed or rendered. If the user then clicks that link, Chrome can load the page almost instantly because the resources are already cached.

Key details of the prefetch process:

  • Eligibility: Chrome only prefetches if the page is served over HTTPS, the URL is same-origin or cross-origin with proper CORS headers, and the page doesn't contain sensitive headers like Authorization or Set-Cookie that would be leaked.
  • User settings: If the user has enabled "Preload pages" in Chrome settings (which is on by default), prefetching proceeds. If disabled, speculation rules are ignored entirely.
  • Network conditions: Chrome may skip prefetching on slow connections or when the user has data saver mode enabled.
  • Cache control: The fetched response must be cacheable (e.g., not Cache-Control: no-store).

How to Choose: Prefetch vs. Prerender

Speculation rules support two actions: prefetch and prerender. They are often confused, but they differ significantly in cost and benefit.

  • Prefetch downloads the page and its resources but does not execute JavaScript or render anything. It uses less memory and bandwidth, but the page may still take a moment to parse and execute when clicked.
  • Prerender fully loads the page in a hidden tab, including running JavaScript and rendering the DOM. This makes navigation virtually instant, but it consumes much more memory and CPU, and it can trigger side effects (like analytics or ad calls) that the site might not want.

For most sites, prefetch is the safer choice because it is lighter and less likely to cause issues. Prerender should be used only for high-confidence links (e.g., the "next" button in a paginated list) where the user is almost certain to click.

Common Problems and Misconceptions

One common misconception is that speculation rules cause Chrome to prefetch every link on a page. That is false — the site must explicitly list the URLs. Another misconception is that prefetching is a privacy risk because it reveals user behavior to the site. In reality, the site already knows which links are on the page; prefetching just tells it which ones Chrome chose to fetch, which is similar to a normal click.

However, there are real issues:

  • Bandwidth waste: If Chrome prefetches a page that the user never clicks, the data is wasted. Chrome tries to mitigate this by only prefetching when the user hovers over a link (if the rules say so) or when the link is very likely to be clicked.
  • Cookie leakage: Prefetching sends cookies to the server, which could be a problem if the page is cross-origin. Chrome blocks prefetch for requests that would carry Authorization headers or that are cross-origin without appropriate CORS.
  • Broken pages: Some pages rely on JavaScript to set up their environment; prefetching the HTML alone might not be enough, so the page might not look right when clicked. This is why prerender exists, but it's heavier.

Comparison: Speculation Rules vs. Old Prefetch Methods

Before speculation rules, developers used <link rel="prefetch"> or <link rel="prerender">. Those are still supported but have limitations:

  • Link prefetch is a simple hint that Chrome may ignore, especially on mobile or when data saver is on. It also doesn't allow conditions like "only on hover."
  • Link prerender was deprecated in Chrome 85 and removed later, because it was too aggressive and often wasted resources. Speculation rules are the intended replacement.

Speculation rules are more granular: you can specify that certain links should be prefetched only after the user hovers for 200ms, or that a list of URLs should be prefetched immediately. This control reduces waste and improves performance.

Safety and Privacy Considerations

Prefetching is generally safe, but there are edge cases. Chrome will not prefetch a page if the response contains a Vary header that could change based on cookies, nor if the page sets cookies that could be considered sensitive. Also, prefetching can cause the server to log requests that the user didn't actually make, which could skew analytics. To avoid this, sites can use the Sec-Purpose header (set to prefetch) to detect prefetch requests and handle them differently.

For users, the main safety concern is that prefetching can consume data on metered connections. Chrome respects the "Preload pages" toggle in settings, which users can turn off to disable all speculation. There is also a per-site option to block preloading.

Alternatives to Speculation Rules

If a site doesn't want to use speculation rules, there are other ways to speed up navigation:

  • Service workers can cache pages and resources proactively, and they can even intercept navigation requests to serve cached responses.
  • HTTP/2 Server Push was an earlier technique, but it's largely deprecated due to inefficiencies.
  • Link prefetch with rel="prefetch" still works but is less powerful.
  • Preconnect and dns-prefetch can reduce connection setup time, though they don't fetch the page itself.

Each approach has trade-offs; speculation rules are currently the most flexible and are the recommended path for modern sites.

Frequently Asked Questions

Does Chrome prefetch all links on a page by default?

No. Chrome only prefetches links that are explicitly listed in a speculation rules JSON block on the page. Without that, Chrome does not prefetch anything.

Can I disable prefetching in Chrome?

Yes. Go to Chrome Settings > Privacy and security > Cookies and other site data (or "Preload pages" in some versions) and turn off "Preload pages for faster browsing and searching." This disables all speculation rules.

Does prefetching use my data?

Yes, it downloads the page and its subresources in the background, which consumes data. On metered connections, you can disable it as above.

Will prefetching cause a site to see my clicks before I click?

The site sees that a prefetch request was made, but it cannot know if you actually clicked. It may log the prefetch as a visit, which can inflate analytics. Sites can use the Sec-Purpose header to distinguish prefetch requests.

Is prefetching safe for pages that require login?

Chrome will not prefetch pages that require authentication headers (like Authorization), and it also blocks prefetching if the response would set cookies. So login pages are generally not prefetched.