Preload, Prefetch & Preconnect
debt(d5/e2/b2/t5)
Closest to 'specialist tool catches it' (d5), Lighthouse and PageSpeed Insights flag missing LCP preloads and unused preloads, but these are performance audits run deliberately, not in normal CI.
Closest to 'one-line patch' (e1), fix is adding or removing a single <link rel='preload'> tag; bumped slightly because you may need to coordinate the 'as' and crossorigin attributes correctly across a few resources.
Closest to 'localised tax' (b3), resource hints live in document <head> and affect only the page templates that include them; minimal architectural pull but slightly more than a single utility.
Closest to 'notable trap' (t5), the misconception that 'more preloading = faster' is a documented gotcha — preloading everything degrades performance, and font preloads silently need crossorigin even same-origin.
Also Known As
TL;DR
Explanation
rel=preload fetches a resource at high priority for the current page (critical fonts, hero images, LCP elements). rel=prefetch fetches resources at low priority for future navigation. rel=preconnect establishes TCP+TLS connections to origins early — useful for CDNs and third-party APIs. rel=dns-prefetch resolves DNS only, useful for many origins. Each hint has a cost — preloading something that is never used wastes bandwidth and delays other resources.
Common Misconception
Why It Matters
Common Mistakes
- Preloading resources that are not used on the page — browser warns about unused preloads.
- Not specifying the 'as' attribute on preload — browser cannot prioritise correctly without it.
- Using preload for resources below the fold — use prefetch instead; preload is for current-page critical resources.
- Missing crossorigin attribute on font preloads — fonts need CORS even from the same origin.
Code Examples
<!-- Preload without 'as' attribute — low priority, no type hint:
<link rel="preload" href="hero.jpg">
<!-- Font preload missing crossorigin — fetched twice:
<link rel="preload" href="font.woff2" as="font">
<!-- LCP image preload:
<link rel="preload" href="hero.webp" as="image" fetchpriority="high">
<!-- Font preload with crossorigin:
<link rel="preload" href="font.woff2" as="font" type="font/woff2" crossorigin>
<!-- Preconnect to CDN origin:
<link rel="preconnect" href="https://cdn.example.com">
<!-- Prefetch next page resources:
<link rel="prefetch" href="/checkout" as="document">