preload
A resource hint, <link rel="preload">, that makes the browser download a file needed for the current page right away at high priority.
In more detail
Use it for resources the preload scanner cannot discover early, such as a web font referenced only from CSS or the hero image for Largest Contentful Paint. A preload that is never used, or whose as or crossorigin value does not match the real request, wastes bandwidth and can download the file twice.
Example
<link rel="preload" href="/fonts/inter.woff2" as="font" type="font/woff2" crossorigin>Related terms
- prefetch — A resource hint, <link rel="prefetch">, that downloads a file at low priority during idle time because the user will probably need it on a later page.
- preconnect — A resource hint, <link rel="preconnect">, that makes the browser do the DNS lookup, TCP handshake and TLS negotiation with another server before any request is sent.
- resource hint — A link element that tells the browser in advance about something it will need, such as preload, prefetch or preconnect, so it can start early.
- preload scanner — A secondary parser that skims ahead through the HTML while the main parser is blocked and starts downloading scripts, stylesheets, fonts and images early.
- Largest Contentful Paint — A Core Web Vital: the time from starting to load a page until its largest visible image or text block is drawn.
Taught in
- Layout, Reflow, Paint And GPU Compositing Layers — Frontend Architecture & Web Platform
- Critical Rendering Path: Preload, Prefetch And Scripts — Frontend Architecture & Web Platform
- Core Web Vitals: Measuring And Optimizing LCP, INP, And CLS — Frontend Architecture & Web Platform