0Pricing
Web Performance Optimization & Lighthouse · Leçon

Préchargement et indications de ressources

Utilisez preload, prefetch, preconnect et les indications de priorité pour récupérer plus tôt les ressources essentielles et réduire le délai avant le premier affichage significatif.

Préchargement et indications de ressources est une leçon Web Performance Optimization & Lighthouse gratuite sur CoddyKit. Ceci est la leçon 4 sur 4. Tu peux lire la leçon complète ci-dessous gratuitement — puis la pratiquer en direct dans le navigateur avec un éditeur de code intégré et un tuteur IA 24/7. Elle fait partie du parcours d'apprentissage Web Performance Optimization & Lighthouse, et ta progression se synchronise sur le web et l'application CoddyKit. Le cours Web Performance Optimization & Lighthouse comprend 4 leçons au total.

Certaines parties de cette leçon n'ont pas encore été traduites et s'affichent en anglais.

Helping the Browser Prioritize

The browser discovers resources as it parses HTML, but key assets like fonts or hero images may be found late. Resource hints let you tell the browser what to fetch early, shrinking the critical path.

preconnect

preconnect opens the DNS + TCP + TLS connection to an origin ahead of time, so the actual request starts faster. Ideal for font and CDN origins.

<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>

dns-prefetch

dns-prefetch is a lighter hint that resolves only DNS. Use it as a fallback for browsers without preconnect or for many third-party origins.

<link rel="dns-prefetch" href="https://analytics.example.com">

preload

preload fetches a specific resource the current page needs soon, at high priority. Always set the correct as attribute so the browser assigns the right priority and reuses the fetch.

<link rel="preload" href="/fonts/inter.woff2" as="font" type="font/woff2" crossorigin>

Preloading the LCP Image

The hero image driving Largest Contentful Paint is often discovered late. Preloading it can cut LCP significantly.

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

prefetch

prefetch fetches resources for a future navigation at low priority during idle time. Great for the next page a user is likely to visit.

<link rel="prefetch" href="/dashboard.js">

Priority Hints

The fetchpriority attribute nudges relative priority. Mark the hero image high and below-the-fold or non-critical assets low.

<img src="/hero.webp" fetchpriority="high" alt="Hero">
<img src="/footer-logo.png" fetchpriority="low" alt="Logo">

modulepreload

For ES modules, modulepreload preloads a module and its dependency graph, avoiding the waterfall of discovering imports one by one.

<link rel="modulepreload" href="/app.mjs">

Avoiding Over-Preloading

Hints compete for bandwidth. Preloading too much delays truly critical resources and can hurt performance. Preload only assets that are critical and discovered late.

Verifying Hints

Check the DevTools Network panel: preloaded resources show high priority and early start times. Lighthouse flags both missing preloads for the LCP element and unused preloads.

Choosing the Right Hint

  • preconnect warm up an origin.
  • preload critical asset for this page.
  • prefetch asset for the next page.
  • fetchpriority fine-tune relative order.

Quick Check

You want a hero image that drives LCP to download as early and as high priority as possible. Which hint fits best?

Recap

You learned to steer the critical path with resource hints: preconnect/dns-prefetch for connections, preload/modulepreload for current-page assets, prefetch for future pages, and fetchpriority to fine-tune. Use them sparingly and verify in DevTools.

Questions Fréquemment Posées

La leçon « Préchargement et indications de ressources » est-elle gratuite ?

Oui — le texte complet de « Préchargement et indications de ressources » est gratuit à lire ici sur le web. Pour la pratiquer de manière interactive (un éditeur de code intégré et un tuteur IA 24/7) et déverrouiller le reste du cours Web Performance Optimization & Lighthouse, passe à CoddyKit PRO. Le cours Web Performance Optimization & Lighthouse comprend 4 leçons au total.

Qu'est-ce que j'apprendrai dans « Préchargement et indications de ressources » ?

Utilisez preload, prefetch, preconnect et les indications de priorité pour récupérer plus tôt les ressources essentielles et réduire le délai avant le premier affichage significatif. Tu pratiques Web Performance Optimization & Lighthouse avec du code pratique que tu exécutes directement dans le navigateur, et un tuteur IA 24/7 répond à tes questions au fur et à mesure que tu avances dans la leçon.

Dois-je avoir de l'expérience pour commencer Web Performance Optimization & Lighthouse ?

Aucune expérience préalable n'est requise. Web Performance Optimization & Lighthouse sur CoddyKit est structuré pour les débutants jusqu'aux apprenants avancés, donc tu peux commencer ici ou depuis le début et avancer à ton rythme. Ceci est la leçon 4 sur 4.

Combien de temps prend la leçon « Préchargement et indications de ressources » ?

La plupart des leçons CoddyKit prennent environ 5–10 minutes. Chacune est courte et interactive, tu progresses régulièrement et tu repiques exactement où tu t'es arrêté sur le web et l'app.

Peux-tu écrire et exécuter du code dans cette leçon Web Performance Optimization & Lighthouse ?

Oui. Chaque leçon Web Performance Optimization & Lighthouse inclut un éditeur de code intégré, tu écris et exécutes du vrai code directement dans ton navigateur et tu reçois des retours IA instantanés — aucune configuration locale requise.

Toutes les leçons de ce cours

  1. Comprendre le chemin critique
  2. Ressources bloquant le rendu
  3. Prioriser le contenu pour accélérer le chargement
  4. Préchargement et indications de ressources
← Retour à Web Performance Optimization & Lighthouse