fetchpriority="high" on Hero Image Element
Issue No: 117
Category: Resource Hints & Performance Issue Type: Warning Priority: Important
Description
Pages with above-fold images should set fetchpriority="high" on the hero <img> element so the browser treats its download as the highest priority resource, reducing render latency for the primary visual content.
Crawler Constraint: The XeoPix crawler can detect
fetchpriority="high"on any<img>tag in raw HTML and count all<img>elements. It cannot determine which specific image is the LCP element — that requires browser rendering and layout measurement. The trigger fires when the page contains<img>elements but none declarefetchpriority="high".
How Do We Capture It
Where to Find
In the HTML <body>:
<img src="/images/hero.webp"
alt="Product hero"
width="1200"
height="600"
fetchpriority="high">
HTML Extraction Flow
The XeoPix crawler downloads the raw HTML response and scans the document body:
- Issues an HTTP GET to the target URL.
- Reads raw response bytes without JavaScript execution.
- Scans all
<img>tags in the full HTML document. - Checks each
<img>for the presence of thefetchpriorityattribute. - Records whether any
<img>hasfetchpriority="high". - Extracts the
srcvalues of all<img>tags withfetchpriority="high". - Records the total count of
<img>tags and count of those withfetchpriority="high".
Validation Logic
The crawler validates:
- Whether any
<img>tag has thefetchpriority="high"attribute. - Whether the attribute value is exactly
high(notloworauto).
How to Get It
Crawler should:
- Parse full raw HTML document.
- Find all
<img>tags withfetchpriorityattribute. - Filter for those where value is
high. - Extract
srcfrom each; count results.
What to Store
| Field | Type | Comment |
|---|---|---|
has_fetchpriority_high_img | BOOLEAN | Whether any img element declares fetchpriority="high" in the page HTML |
fetchpriority_high_img_srcs | TEXT[] | Array of src values from img elements with fetchpriority="high" |
fetchpriority_high_img_count | INT | Number of img elements with fetchpriority="high" on the page |
img_total_count | INT | Total number of img elements found in the page HTML |
has_imgs_without_fetchpriority_high | BOOLEAN | Whether the page has img elements but none declare fetchpriority="high" |
Condition for Trigger
The following trigger rule fires only when the page contains img elements but none declare fetchpriority="high".
- Trigger Rule 1: Page Has Images But No fetchpriority="high" Declared
- Target Field:
has_imgs_without_fetchpriority_high - Evaluation Logic:
= TRUE - Severity: WARNING
- Diagnostic Message: "This page contains img elements but none declare fetchpriority="high". The above-fold hero image should use this attribute to signal the browser to prioritize its download above other resources, reducing render latency for the primary visual content."
- Target Field:
Sources
- MDN — HTMLImageElement: fetchpriority property
- web.dev — Optimize LCP: Use fetchpriority
- Google Search Central — Core Web Vitals: LCP
- WHATWG HTML Standard — fetchpriority attribute
- Chrome Developers — Priority Hints
Long Description
fetchpriority is a priority hint attribute that tells the browser how to prioritize the fetch for a resource relative to other resources of the same type. When set to "high" on an <img> element, the browser elevates that image request to the highest network priority, ensuring it is downloaded before competing resources.
For LCP optimization, fetchpriority="high" complements <link rel="preload"> (Issue 115) by working directly at the element level rather than in the head:
| Approach | Mechanism | Best for |
|---|---|---|
<link rel="preload" as="image"> | Head-level early discovery | Images in CSS background or lazy-loaded via JS |
fetchpriority="high" on <img> | Element-level priority signal | Images already in HTML <img> tag |
Without fetchpriority="high":
The browser assigns resource priorities automatically based on heuristics (position in page, resource type, render-blocking status). For images, the browser typically assigns low or medium priority unless they are in the initial viewport. Without a hint, even above-fold hero images can be delayed by competing high-priority resources.
With fetchpriority="high":
The browser immediately promotes the image fetch to Highest priority in the network scheduler. Chrome DevTools shows this as Priority: Highest in the Waterfall view.
Common failure scenarios:
1. Hero Image Uses Default Priority
<!-- No hint — browser assigns Low or Medium priority -->
<img src="/hero.webp" alt="Hero" width="1200" height="600">
In cases where the page has many resources, the hero image may be downloaded after blocking scripts and stylesheets.
2. fetchpriority="high" on Multiple Images
<!-- BAD: Multiple images with high priority dilutes the benefit -->
<img src="/hero.webp" fetchpriority="high">
<img src="/banner.webp" fetchpriority="high">
<img src="/product.webp" fetchpriority="high">
Marking multiple images as high priority can increase LCP time because the browser cannot differentiate them. Only the true LCP element should receive fetchpriority="high".
3. fetchpriority="high" With lazy loading Conflict
<!-- WRONG: lazy loading overrides fetchpriority="high" -->
<img src="/hero.webp" loading="lazy" fetchpriority="high">
Using loading="lazy" with fetchpriority="high" is contradictory. The lazy attribute defers the fetch until the image enters the viewport. Above-fold LCP images should use loading="eager" (the default) or omit loading entirely.
4. Image Injected by JavaScript
If the LCP image is added to the DOM by JavaScript, fetchpriority="high" cannot be applied via HTML. A <link rel="preload" as="image"> in <head> (Issue 115) is the correct solution in that case.
How to Fix
Add fetchpriority="high" to the above-fold hero image element:
<img src="/images/hero.webp"
alt="Product hero image"
width="1200"
height="600"
fetchpriority="high">
Guidelines:
- Apply
fetchpriority="high"to only one image per page — the true LCP element. - Do not combine with
loading="lazy"— above-fold images should never be lazy-loaded. - For responsive images using
srcset, the attribute belongs on the<img>tag:<img srcset="/hero-400.webp 400w, /hero-800.webp 800w"sizes="100vw"src="/hero-800.webp"alt="Hero"fetchpriority="high"> - For
<picture>elements, placefetchpriority="high"on the inner<img>fallback tag, not on<source>. - Consider pairing with
<link rel="preload" as="image">(Issue 115) for maximum LCP benefit when the image URL is known at HTML parse time.