Prefetching the next click: a practical guide for faster sites
Every website lives with a small gap between intent and response. A shopper in Sydney taps a product tile at lunchtime, the browser opens a socket, an edge server asks the origin for HTML, the origin waits on a database query, and only then does the product page paint. Page prefetching closes that gap by starting the network work before the user has finished deciding. The technique predicts the next user action and quietly pulls the page, script or image that action will need, so the click lands on something already warm. Learn more about The Basics Of Database Optimization For Dynamic Content.
Browsers already guess. The preload scanner in every modern engine fetches fonts, images and scripts it discovers while parsing the current document, and some engines speculate further ahead on their own. What explicit prefetching adds is intent and priority: the resource is marked as belonging to a future navigation, fetched at a lower priority than the current view, and dropped into the browser cache ready for reuse. That distinction matters more today, because Australian pages now carry heavier bundles, larger product media and more third-party tags than the pages most performance advice was written for. Learn more about Vacuums.net.ua.
This guide covers what page prefetching does at the browser level, how to read intent from signals already on the page, how to implement prefetching with speculation rules and link prefetch, why the server still has to be fast, and how to measure the result on the networks Australians actually use. It suits teams running content, e-commerce and media properties who can edit markup and ship front-end assets but do not want to rebuild their rendering stack. Companion background reading sits in SpeedTao's journal, on the database and network sides of the same problem. Learn more about How To Test Your Site S Speed On Different Networks.
The examples assume current Chromium, Safari and Firefox behaviour, with a service worker standing in for older clients. The conditions referenced throughout come from Australian realities: NBN connections split between fibre-to-the-premises, fibre-to-the-cabinet and copper, mobile broadband on 4G and 5G in Melbourne, Brisbane and Perth, and thinner regional links that sometimes hold only a bar or two. The same code behaves very differently on each of those, which is why measurement gets as much attention here as markup.
What page prefetching actually does
Prefetching sits between two techniques you already know. A preload tells the browser a resource is needed for the current page and fetches it at high priority, ahead of the parser. A prefetch says the resource may be needed for the next navigation and fetches it at the lowest priority the browser will use, generally once the current page falls idle. A prerender goes further: it fetches the document and renders it in the background so a future navigation can swap it in almost instantly.
Current browsers express this through the Speculation Rules API, which lets you declare a rule such as "every URL matching /products/ is worth prefetching" in a small inline script and let the engine handle prioritisation, cache reuse and cancellation. The prefetch travels as a request carrying an intent hint, the response is stored in the browser's prefetch cache, and the following navigation reads from that cache instead of opening a new connection.
Timing and storage are the catch. A prefetch helps only while the entry stays alive; browsers keep prefetched responses for a short window and discard them under memory pressure. If the user navigates before the response lands, the browser reuses the in-flight request, which helps. If the response arrives after the navigation has already begun, the benefit evaporates. Prefetch also competes for the same bandwidth as the page being viewed, so aggressive rules can make the current view slower on a constrained connection. Chrome's Data Saver setting suppresses prefetch entirely, and metered connections deserve the same respect.
Reading intent from the signals already on the page
The best prefetch targets come from signals the page already carries rather than from prediction models. The clearest is a pointer: when a cursor settles over a link for a few hundred milliseconds, the user has usually decided where they are going. Keyboard focus is the equivalent for people navigating by tab. Both are cheap to listen for with pointerenter and focus events, so you can attach rel="prefetch" at the moment intent appears.
Touch screens complicate the picture, and Australia makes that concrete: much traffic to consumer sites here arrives on a phone held one-handed on a train, a bus or a kitchen bench. There is no hover, and the gap between touching a link and the navigation starting can be under a second. Two alternatives carry more weight on mobile. Visibility in the viewport, detected with an IntersectionObserver, tells you which cards a user can actually see; and touchstart reveals the destination before the click event fires.
Intent also comes from structure. Search results lead to a detail page, a detail page leads to reviews or a related product, a basket leads to checkout, a carousel leads to the next slide. A catalogue such as that vacuum retailer illustrates the pattern: a grid of products with predictable destinations, heavy product imagery and filters that run a query per variant change, where one well-scoped prefetch rule removes the wait from every tile the user taps.
Combine the signals rather than leaning on one. A link that is visible, recently visited and matches a known route deserves a prefetch; a link buried in a footer does not. Where you have traffic data, the routes with the highest click-through from a given page are the safest place to begin.
Wiring up speculation rules and prefetch hints
A minimal rules file is a script with type="speculationrules" holding a prefetch action, an href_matches condition and an eagerness of moderate, which means the browser starts fetching once the current page is quiet and abandons the work if the user clicks elsewhere. Raising eagerness to high reserves memory and CPU for a prerender, making the swap nearly free.
Frameworks help with the plumbing. Next.js prefetches links that enter the viewport by default, React exposes usePrefetch for route-level hints, and most CMS plugins ship a prefetch attribute for internal links. Two details trip people up. The prefetched response must be cacheable in a way the browser can reuse, so serve public routes with sensible Cache-Control headers and avoid a Vary header that changes per session. And personalised pages should never be prefetched into a shared cache, because a response built around one shopper's basket can be handed to another.
Treat bandwidth as a budget. Rules matching every internal link on a content-heavy page will pull tens of megabytes while the user reads the first paragraph. Start with one pattern, measure the payload, and widen the rules only where the data supports it. Alongside prefetching, a fetchpriority="high" on the largest contentful image and properly sized thumbnails still deliver more than any speculative rule, because they cut work from the page being viewed rather than the one after it.
Prefetched pages that arrive too late
Prefetching is a latency trick, not a compute trick. If the origin takes a second to respond because of an unindexed query, the prefetch simply starts that wait earlier and the next click still lands on an empty screen. The work behind that response is invisible from the front end, which is why the server deserves attention before any rule ships. The notes on database optimization for dynamic content walk through the usual suspects, from missing indexes to N+1 queries on every request.
Aim for a short, warm origin. Cache the expensive sections at the edge or in a fragment cache, precompute recommendation blocks that change slowly, and keep the dynamic part of a page down to what genuinely differs per request. Once a document can be produced in a few tens of milliseconds, prefetching has something worth carrying and the next user action feels immediate rather than merely earlier. Test the path with a cold cache as well, because a prefetch that only wins after a page has been warmed once tells you very little about real traffic.
Choosing targets and proving the gain
Judge prefetching with two kinds of evidence. In the lab, measure navigation timing and confirm that the next navigation returns from cache with a near-zero transfer, then compare interaction to next paint for the same click with prefetching disabled. In the field, watch the interaction to next paint metric and the share of navigations served from the prefetch cache, since real visitors on real connections will not behave like a laboratory profile.
The network is where Australian conditions bite hardest. A guide to testing speed across networks shows how to shape the picture with throttling profiles for 4G, congested Wi-Fi and a regional connection, and how to set tests from Sydney, Melbourne and Perth nodes rather than one convenient location. Compare those results with the numbers your own visitors generate, and remember that a fibre-to-the-cabinet household and a fixed wireless user in a regional town experience the same site very differently.
Strong candidates for early prefetching:
- Detail pages reached from a listing, grid or search results
- The next item in a carousel, playlist or paginated feed
- Basket, checkout and account entry points on the way to purchase
- Related articles and guides linked from the end of an article
Habits that waste bandwidth:
- Prefetching routes that depend on a logged-in session
- Matching every internal link on a media-heavy page
- Serving prefetched documents without cache headers the browser can reuse
- Ignoring Data Saver, metered connections and low-memory devices
Roll this out as a measured experiment rather than a switch. Pick one high-confidence route, ship a narrow rule, watch the cache reuse rate and the interaction metrics for a fortnight, then decide whether the pattern is worth widening or should be rolled back. Prefetching rewards restraint, and a small rule that fires on genuine intent is worth more than a broad one that fires on everything.