Naar hoofdinhoud
← πŸ“„ HTML & the platformΒ·Module A7 Β· Les 6
OpdrachtAdd three images: hero with fetchpriority='high', mid-page (no attr), offscreen with loading='lazy' fetchpriority='low'.

fetchprioriteit voor het afstemmen van de resourcewachtrij

100 XP6 min
Theorie

A relatively new attribute (2023+)

<!-- LCP image: highest priority -->
<img src="/hero.webp" fetchpriority="high" alt="Hero" />

<!-- Decorative offscreen image: lowest priority -->
<img src="/decoration.svg" fetchpriority="low" alt="" />

<!-- Below-fold but probably important -->
<img src="/article-cover.jpg" loading="lazy" />

Three values

  • high β€” promote ahead of same-type resources. Use on LCP image and critical scripts.
  • low β€” deprioritize. Use on offscreen images, optional scripts.
  • auto β€” browser decides (default).

When it actually matters

Modern browsers pipeline downloads aggressively β€” preloads + parallel HTTP/2 streams. But on slow connections (mobile 3G) or pages with 50+ images, queue ordering still affects LCP by 200-500ms.

On <link rel="preload">

<link rel="preload" as="image" href="/hero.webp" fetchpriority="high" />

Combine preload + fetchpriority="high" to jump your LCP image to the front of the queue before HTML parsing even reaches the <img> tag.

πŸ”’

Registreer om te beginnen met coderen

Theorie is voor iedereen. De editor, live preview en check ontgrendelen met een 7-daagse gratis proefperiode β€” kaart vereist, opzegbaar.

Registreren β€” gratis proef β†’

De eerste 10 lessen in elke track zijn gratis. Geen kaart nodig.

← VorigeVolgende les β†’

EΓ©n Python- of web-tip per dag β€” per e-mail

Kort, met de hand geschreven, geen spam. Met één klik afmelden.