Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

fetchpriority — resource fetch priority

The fetchpriority attribute sets the relative fetch priority of images, external scripts, and resources referenced by link. It accepts high, low, or auto; it does not guarantee the order in which fetches finish.

Version: WHATWG HTML Living Standard; index snapshot date recorded separately

Syntax

fetchpriority="high|low|auto"

fetchpriority is an enumerated attribute controlling fetch priority. The value high signals higher priority, low signals lower priority, and auto leaves the decision to the browser. The comparison concerns resources with the same request destination, such as images compared with other images, not resources sharing a URL or host. An omitted attribute or an invalid value means auto; this is not a boolean attribute.

On img, the attribute concerns fetching the image. On script, it concerns the initial fetch of an external classic or module script, but not its module imports. On link, it is intended for external resource links, such as stylesheets. It is not a global attribute that gives arbitrary elements fetching behavior.

Priority does not guarantee request timing or completion order. It does not replace loading on images or async and defer on scripts: those are separate mechanisms controlling loading or execution. In JavaScript, the corresponding property is fetchPriority, which reflects the attribute and returns only recognized values. The example checks this reflection, not actual network scheduling.

Examples

const image = document.createElement('img');
image.setAttribute('fetchpriority', 'high');
console.log(image.fetchPriority);
image.setAttribute('fetchpriority', 'invalid');
console.log(image.fetchPriority);
image.removeAttribute('fetchpriority');
console.log(image.fetchPriority);

Result

high
auto
auto

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources