How does the Fetch Priority API affect resource loading?

ProcrustesPR

The Fetch Priority API lets web pages specify a resource’s relative loading priority through the fetchpriority attribute. Setting high on an important LCP (Largest Contentful Paint) image lets the browser download it at high priority earlier, potentially improving LCP. But raising priority does not mean a request will be issued immediately: if the image also uses loading=”lazy”, it must still wait for the lazy-loading conditions to be met.

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

Raising priority changes how resource downloads are scheduled

web.dev explains that images are fetched at a lower priority by default. Their priority is raised to High only after the browser completes layout and determines that they are within the initial viewport. Setting fetchpriority=”high” in advance on an image known to be important raises its priority without waiting for layout.

web.dev also describes browser resource loading in two phases. The first is reserved for critical resources and ends only after all blocking scripts have been downloaded and executed. During this phase, downloads of low-priority resources may be deferred. Raising a resource’s priority can allow it to download during the first phase, but does not guarantee that it will finish first.

LCP main images and thumbnails can have different priorities

fetchpriority can be used on link, img, and script elements to specify the relative priority of their resources. web.dev highlights its use for LCP images and uses an image gallery to show how priorities can reflect each image’s importance:

  • Large main image: set fetchpriority=”high” on the img element to raise its download priority earlier.
  • Less important thumbnails: set fetchpriority=”low” to download them at a lower priority.

The point is to distinguish the main image from secondary images, not to mark every image as high. If the large main image is the page’s LCP image, raising its priority may improve LCP. However, web.dev does not specify a fixed amount of improvement, and the example does not establish that every page will see the same results.

loading and fetchpriority address different concerns

loading does not change an image’s network priority. According to web.dev, even an above-the-fold image using loading=”lazy” must wait for CSS to be downloaded, parsed, and applied so the browser can determine its final position. It is not fetched as soon as the preload scanner discovers its markup.

So if an above-the-fold main image is set to both lazy and high, high priority will not remove this wait. When investigating why an important image has not yet loaded, check two things separately: whether the image is still waiting for lazy-loading conditions to be met, and what priority is used when its request is issued. Adjusting priority alone cannot resolve the wait caused by lazy loading.

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

Fetch Priority API: perspectives from across the web

Does setting high guarantee that a resource will download immediately?

No. fetchpriority adjusts relative priority; it does not guarantee an immediate download. In the loading process described by web.dev, the first phase is reserved for critical resources, and low-priority resources may be deferred. Raising a resource’s priority can allow it to download during that phase, but this does not mean it will finish first.

Why might an above-the-fold image still take a long time to be requested even when set to high?

If the image also has loading="lazy", raising its priority will not remove the wait caused by lazy loading. web.dev explains that even an above-the-fold image with this setting must wait for CSS to be downloaded, parsed, and applied so the browser can determine its final position. loading itself does not change the image’s network priority, and high cannot bypass this wait.

Which resources can be assigned different priorities with fetchpriority?

fetchpriority can be used on link, img, and script elements to specify the relative priority of their resources. For example, web.dev’s gallery example sets the large main image to high and less important thumbnails to low. If the main image is also the LCP image, raising its priority earlier may improve LCP, but an improvement is not guaranteed on every page.

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

References

  1. Lazy load images and <iframe> elementsweb.dev — Discusses: Why might an above-the-fold image still take a long time to be requested even when set to high?
  2. Assist the browser with resource hintsweb.dev — Discusses: Does setting high guarantee that a resource will download immediately?; Which resources can be assigned different priorities with fetchpriority?

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