Skip to the page

Loading fast: critical path, hints, images, fonts, caching · mid

Resource hints: preload, preconnect, modulepreload, fetchpriority, Early Hints

Resource hints let you tell the browser about important resources earlier than it would find them: preconnect opens a connection, preload fetches a file now, modulepreload fetches and parses a module, prefetch fetches for a future page, and fetchpriority changes the priority of a fetch.

The notes

What you must know

  • preconnect: do DNS + TCP + TLS to another origin now. Use it for 1 to 3 critical origins (image CDN, font host). dns-prefetch is the cheaper fallback.
  • preload (<link rel=preload as=...>): fetch a resource needed for THIS page now, at high priority. Use it only for late-discovered critical files (LCP background image, font from CSS). Unused preloads waste bandwidth and Chrome warns after 3 s.
  • Fonts must be preloaded with the crossorigin attribute (fonts are always fetched in CORS mode); without it the browser downloads the font twice.
  • modulepreload: fetch and compile an ES module early, before the import that needs it runs (avoids module waterfalls).
  • prefetch: low-priority fetch for a likely NEXT navigation. For full next pages, Speculation Rules (prefetch/prerender) are the modern tool in Chromium.
  • fetchpriority="high" | "low" | "auto" on <img>, <link rel=preload>, <script>, and fetch(url, { priority }). It is a hint. Supported in Chrome 102, Safari 17.2 and Firefox 132. Images start low and are boosted when in the viewport; fetchpriority=high skips that wait for the hero.
  • 103 Early Hints: the server sends Link headers (preconnect, preload) before the final response is ready, so the browser works during server think time. Most browsers only honour it over HTTP/2+.

The red pen

Common traps: mistake → fix

  • Mistake: "Preload all fonts and scripts"

    Fix: too many preloads compete with the LCP image; preload only what is late-discovered and critical.

  • Mistake: "preload and prefetch do the same thing"

    Fix: preload is for this page at high priority; prefetch is for a future navigation at low priority.

  • Mistake: "Preconnect to every third-party domain"

    Fix: each open connection costs CPU and is dropped after about 10 s if unused; keep it to a few.

Easy to hard

Questions interviewers ask, easy to hard

  1. What is the difference between preload, prefetch and preconnect?
  2. Why does a preloaded font need crossorigin?
  3. When does fetchpriority help LCP, and when does it do nothing?
  4. How do 103 Early Hints help a server-rendered page with a slow backend?

Explain it out loud

Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.

Practise by voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview