How can you help browsers discover important resources earlier?

ProcrustesPR

To help browsers discover important resources earlier, first aim to put references to critical resources in the HTML sent by the server so the preload scanner can find them sooner. If the loading method cannot be changed and still delays discovery, consider using preload hints. Before making changes, identify which resources are important and whether their references are in HTML, CSS, or JavaScript-generated content. The goal is to help the browser find resources sooner, not to preload every file.

ProcrustesPRProcrustesPRHow Should a CMS Handle Images? From Upload Optimization to Descriptions and URL Management

First, identify when resource references become available

The preload scanner is a secondary HTML parser in the browser. It scans the original HTML and speculatively starts fetching resources before the main parser discovers them. Even when the main parser is blocked while processing CSS or JavaScript, the scanner may still find images referenced by image elements in the HTML and start downloading them.

When reviewing the loading process, start by asking: Are references to important resources already present in the HTML returned by the server? Or do they only become available after stylesheets are parsed or scripts run? The preload scanner is not the same as a preload hint: the scanner is a browser parsing optimization, while a preload hint is an explicit resource hint provided by the website.

Prioritize changes to loading methods that delay discovery

web.dev lists several loading methods that prevent the preload scanner from discovering resources directly. If critical resources are loaded this way, first assess whether the method can be changed:

  • CSS background images: Image references are in stylesheets rather than the original HTML.
  • Dynamically loaded scripts: For example, script elements inserted using JavaScript, or dynamic import().
  • Client-generated HTML: The markup is initially hidden in JavaScript strings, which the scanner cannot read directly.
  • CSS @import: This also delays resource discovery.

For example, when multiple stylesheets need to be loaded, web.dev recommends using multiple stylesheet link elements rather than CSS @import. These recommendations address discovery timing; they do not mean that all background images or dynamic loading must be eliminated. First determine whether the resources loaded this way are critical and need to be fetched early.

Use preload selectively when references cannot appear earlier

If the loading method cannot be changed, consider using preload to reduce discovery delays. For example, preloading lets the browser start downloading specified fonts without waiting for stylesheets to finish downloading and being parsed.

However, the browser will download those fonts without waiting to confirm that the page needs them. Preload only genuinely important fonts rather than every font; overuse may divert bandwidth from other critical resources. Font preloads also require the crossorigin attribute, even when the fonts are hosted on your own website. Earlier discovery does not guarantee that the entire page will load faster.

ProcrustesPRProcrustesPRHow should images of different sizes on the same website be named?

Earlier resource discovery: perspectives from across the web

Can images still start downloading early when the main HTML parser is blocked?

Yes, potentially. If image elements and their resource references are already in the original HTML sent by the server, the preload scanner may find the images and speculatively start downloading them even when the main parser is blocked while processing CSS or JavaScript. This does not apply to all images: references hidden in CSS or client-generated content cannot be discovered directly by the scanner in the same way.

What should you do if an important image is used as a CSS background?

First confirm that the image is a critical resource that needs to be fetched early. If it is, assess whether you can change how it loads so that its reference appears in the HTML sent by the server. If it must remain a CSS background image, consider a preload hint so the browser does not have to wait to discover its reference in the stylesheet. Noncritical background images do not need to be changed for this reason alone.

What are the trade-offs of preloading fonts?

Preloading lets specified fonts start downloading before stylesheets finish downloading and being parsed, but the browser will request them without waiting to confirm that the page needs them. Choose fonts that are genuinely important rather than preloading every font; overuse may divert bandwidth from other critical resources. Font preloads require the crossorigin attribute, including for self-hosted fonts.

ProcrustesPRHow many image variants should you prepare, and how should you manage them?

References

  1. Optimize resource loadingweb.dev — Discusses: Can images still start downloading early when the main HTML parser is blocked?; What should you do if an important image is used as a CSS background?
  2. Optimize web fontsweb.dev — Discusses: What are the trade-offs of preloading fonts?

Related articles

How Should a CMS Handle Images? From Upload Optimization to Descriptions and URL ManagementHow should images of different sizes on the same website be named?How many image variants should you prepare, and how should you manage them?How do visual and short-form video trends in search results affect SEO?How can photography websites use SEO to increase visibility and attract clients?How can service and e-commerce websites improve search visibility? Start by distinguishing local needs from buying intentWhy optimize a website, and which tasks can be done for free?How can you use search results page features to attract traffic?
ProcrustesPR
ProcrustesPR