---
title: "Fetch the next page on hover · Agent Wranglers"
url: https://agentwranglers.se/playbook/website/performance/speculation-rules
updated: 2026-10-20
licence: "All rights reserved"
---

# Fetch the next page on hover

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Recommended
- Chapter: [Performance](https://agentwranglers.se/playbook/website/performance)
- Rule: Fetch or fully load likely next pages ahead of time with Speculation Rules, but skip addresses that change something.
- How: Add `<script type="speculationrules">` with `prefetch` (or the heavier `prerender`) for links on the same site. Chromium browsers act on it, and other browsers ignore the script safely. Use `eagerness: moderate`. On desktop it starts after a short hover, and on phones when a link is near where the visitor stopped scrolling. Leave out file links and paths that change something, such as sign-out. Avoid `immediate` on pages with many links, because it competes with the page's own load. Count analytics only after a prerendered page is shown, using `document.prerendering` and the `prerenderingchange` event.
- Check: In DevTools › Application › Speculative loads, hover a link and see it prefetched. In the lab, time the first click, or watch CDP `Preload.prefetchStatusUpdated`. The rules exclude every path that signs out, deletes or changes data.
- Measured: On a reference site, fetching every link at once (`immediate`) cost 0.6 s of mobile LCP on a short page in Lighthouse. On a page with about 50 links it cost 1.9 s against `moderate`. Data downloaded went from 89 to 403 KB. In Chrome with a warm service worker cache, `immediate` clicks took 63 ms against 65 ms with no rules (phone). In an earlier lab, removing a view transition took a prefetched click from 111 to 59 ms.

Example:

```html
<script type="speculationrules">
{
  "prefetch": [{
    "where": { "and": [
      { "href_matches": "/*" },
      { "not": { "href_matches": "/logout" } },
      { "not": { "href_matches": "/*.pdf" } }
    ]},
    "eagerness": "moderate"
  }]
}
</script>
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/performance/speculation-rules`.

- Previous: [Drop old HTTP/1 tricks](https://agentwranglers.se/playbook/website/performance/http1-workarounds)
- Next: [Keep the back button instant](https://agentwranglers.se/playbook/website/performance/bfcache)
- [Performance](https://agentwranglers.se/playbook/website/performance)
