Future of the Web 5 min read

Instant page loads with prefetching and speculation rules

Browsers can load the next page before the visitor clicks. How it works and when to use it.

On this page 10 sections

Most work on website speed focuses on the first page a visitor sees. But visitors rarely stop at one page. They move from the homepage to a service, then to pricing, then to contact. Each of those clicks means another wait.

Browsers can now remove much of that wait by loading the next page before the visitor clicks. When it works, the next page appears almost instantly. The technique has been around in simple forms for years, and the newer Speculation Rules API makes it more powerful and easier to control. This guide explains how it works, where it’s supported and how to use it without wasting visitors’ data.

The short answer

  • Prefetching downloads the next page’s HTML in advance, so it opens faster when clicked.
  • Prerendering goes further: the browser loads and renders the whole page in the background, so it can appear instantly.
  • The Speculation Rules API lets a site tell the browser which pages to prefetch or prerender, and when.
  • At the time of writing, support is limited to Chromium-based browsers, such as Chrome and Edge. Other browsers ignore the rules and load pages normally.
  • Use it carefully: speculate only on likely next pages, and never on links that change something, such as logging out or adding to a cart.

How it works

When a visitor is on a page, the browser can often guess where they’ll go next: a link they’re hovering over, the main call to action, or the next article in a series. Speculation rules turn that guess into instructions.

A site adds a small block of rules to its pages. The rules list which addresses may be loaded in advance and how eagerly. For example:

<script type="speculationrules">
{
  "prerender": [{
    "where": { "href_matches": "/*" },
    "eagerness": "moderate"
  }]
}
</script>

This tells supporting browsers that any page on the same site may be prerendered, with moderate eagerness. In practice, that means the browser starts when the visitor holds the pointer over a link for a moment, or begins to tap it. By the time the click finishes, much of the page may be ready.

Chrome’s documentation on prerendering pages explains the options in detail, and MDN’s reference for the Speculation Rules API shows the current browser support.

Prefetch or prerender?

Prefetch Prerender
What happens in advance The page’s HTML is downloaded The whole page is loaded and rendered
Speed gain Faster Near instant
Cost if unused Low Higher: data, memory and processing
Best for Many possible next pages A few very likely next pages

Prefetching is the safer choice when you’re not sure where visitors will go. Prerendering gives the best experience but costs more when the guess is wrong.

Choosing how eager to be

The eagerness setting controls when speculation starts:

  • immediate or eager: as soon as the rules are seen, or very soon after. Use for one or two pages almost everyone visits next.
  • moderate: when the visitor hovers over a link or starts to tap it. A good default for most business sites.
  • conservative: only when the visitor presses down on the link. The smallest gain, but almost no waste.

A sensible setup for a business website

For most company websites, a simple configuration works well:

  1. Prefetch or prerender same-site pages with moderate eagerness, so speculation starts only when a visitor shows intent.
  2. Exclude anything that performs an action, such as login and logout links, form endpoints, cart and checkout addresses, and file downloads.
  3. Exclude very heavy pages, such as large galleries or pages with autoplaying video, unless they are the obvious next step.
  4. Consider eager prerendering for one key page, such as the contact or pricing page, if most visitors go there next.
  5. Test in Chrome with developer tools open, then check that analytics counts look the same as before.

This keeps the benefit for real visitors while avoiding wasted downloads.

What to watch out for

Prerendering loads a page as if the visitor had opened it. Never apply rules to addresses that log someone out, add items to a cart, change settings or trigger an action. Exclude them explicitly in the rules.

Analytics and advertising scripts

A prerendered page that is never shown should not count as a visit. Modern analytics tools generally handle this, but check that page views and conversions are counted only when the page is actually shown.

Data and battery use

Prerendering pages that visitors never open uses their data and battery. Browsers limit speculation on slow connections and in data saver modes, but restraint on your side matters too. Choose moderate or conservative eagerness unless you’re sure.

It doesn’t fix a slow page

Speculation hides loading time for the next page. It doesn’t make the first page faster, and a heavy page still costs data. Treat it as a finishing touch on a site that is already fast, not as a substitute for the basics. Start with the basics: our website speed optimisation guide covers them.

  • The back/forward cache (bfcache) lets browsers restore a page instantly when visitors press back. Avoid patterns that block it, such as certain unload handlers. Google’s guide to the back/forward cache explains what to check.
  • View transitions smooth the change between pages. Our guide to view transitions shows how they work alongside fast loading.
  • Caching and a CDN reduce the time each page takes to arrive. Our guide to caching and CDNs covers the basics.

Speculation rules on WordPress

Recent versions of WordPress include speculative loading support, which adds prefetching rules with conservative eagerness to the front end of the site by default. Check what your version does, and whether your theme or speed plugin adds its own rules on top. Two systems doing the same job can waste data without making the site any faster.

Frequently asked questions

Does prerendering affect SEO?

Not directly. Search engines don’t use speculation rules to rank pages. The benefit is a faster experience for visitors moving between pages, which supports engagement and conversions.

Will speculation rules break my site in browsers that don’t support them?

No. Browsers that don’t understand speculation rules ignore them, and pages load in the normal way.

How do I know if prerendering is working?

In Chrome’s developer tools, the Application panel has a section for speculative loads, listing which pages were prefetched or prerendered and whether they were used.

What to do next

Check whether your site already uses speculation rules: view the source of a page and search for speculationrules. If it doesn’t, start with prefetching at moderate eagerness, excluding any links that perform actions. Then compare how quickly pages open as you move around the site in Chrome.

Fast navigation is one part of a site that feels responsive. Our website design and development service builds sites with a light front end, sensible caching and fast page-to-page navigation from the start.

Written by the PORVIX team

The people who design, build and maintain websites for growing businesses. We write about the questions that come up on real projects, in plain language, and update articles when the advice changes.

Published

How we work

Is your current site costing you enquiries?

A free, plain-language audit, by email within 2 business days.

Get a free audit
Get a free audit

Keep reading

More plain-language guides.

More on the future of the web first, then other guides worth reading next.

All insights

Start here

Let’s build a website that brings in business.

Tell us about your project. You’ll hear back from a real person within one business day, with honest advice either way.

  • Free consultation
  • Fixed written quote
  • Your details stay private