Resource Hints — prefetch
Fetch what the user will probably need next during idle time, so the next navigation feels instant.
preload fetches what this page needs. prefetch fetches what the next page will probably need. It's a bet: download a likely-soon resource at low priority during idle time and cache it, so when the user navigates, it's already there and the transition feels instant.
prefetch vs preload
They share the “pre” but aim at different moments. preload is high-priority and for the current navigation — “I need this now, get it early.” prefetch is low-priority and speculative — “the user will probably need this next, grab it while we're idle.” Prefetch never competes with the resources the current page actually needs.
Instant navigation
The classic trick: prefetch the next page's bundle on hover. There's a 40–400 ms gap between hovering a link and actually clicking it — plenty of time to download in the background. Hover the button (don't click yet), then click and feel the difference:
How to declare it
Like the others, prefetch is a <link> (or HTTP header), and bundlers can emit it for you:
<!-- Plain HTML -->
<link rel="prefetch" href="/pricing.js" as="script">
// Webpack magic comment — emits a low-priority <link rel="prefetch">
import(/* webpackPrefetch: true */ "./routes/Pricing");<Link> in the viewport; many routers prefetch on hover. You often get prefetching for free — the value is understanding the trade-off so you can tune it.The trade-off
Prefetch is a guess. Guess right and navigation feels instant; guess wrong and you've burned the user's data and battery downloading something they never used. On a metered mobile connection that's rude. So the whole game is accuracy vs. overhead: how confident are you they'll go there?
Prediction strategies
Different strategies trade accuracy against how much they download. From crude to clever:
Prefetch-all grabs every link (perfect accuracy, huge waste). Quicklink uses the Intersection Observer to prefetch only links in view. instant.page prefetches on hover. Guess.js trains on your analytics to predict the actual journey. The right pick depends on your traffic and how much data you're willing to spend on a guess.
- →prefetch = low-priority, speculative fetch of what the next navigation will likely need.
- →Contrast with preload (high-priority, this page) — prefetch never competes with current resources.
- →The classic win: prefetch the next route on hover for near-instant navigation.
- →It's a guess — wrong guesses waste data; balance accuracy vs. overhead.
- →Strategies range from prefetch-all to viewport (Quicklink), hover (instant.page), and ML (Guess.js).