← Lessons

quiz vs the machine

Gold1380

Frontend

Resource Hints Preload and Prefetch

Telling the browser what to fetch early and what is coming next.

4 min read · core · beat Gold to climb

Helping the scheduler

The browser discovers resources as it parses, which can be late. Resource hints let you tell it about important resources sooner so the network is used wisely.

The main hints

  • Preload fetches a resource needed for the current page with high priority, like a hero font or critical image, before the parser would find it.
  • Prefetch fetches a resource for a likely future navigation at low priority, so the next page feels instant.
  • Preconnect opens the connection to an origin early so later requests skip the handshake.
  • DNS prefetch resolves a domain name ahead of time.

Use them sparingly

Hints compete for bandwidth. Preloading too much delays the things that truly matter, and prefetching pages the user never visits wastes data. Measure before and after.

Key idea

Preload critical resources for the current page and prefetch likely next pages, but use hints sparingly so you do not starve what matters now.

Check yourself

Answer to earn rating on the learn ladder.

1. What is preload best used for?

2. Why use hints sparingly?