dom / latest / htmllinkelement / fetchpriority.html /

HTMLLinkElement.fetchpriority

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The fetchpriority property of the HTMLLinkElement interface represents a hint given to the browser on how it should prioritize the preload of the given resource relative to other resources of the same type.

Value

A DOMString representing the priority hint. Possible values are:

  • high: Fetch the preload at a high priority relative to other resources of the same type.
  • low: Fetch the image at a low priority relative to other resources of the same type.
  • auto: Default mode, which indicates no preference for the fetch priority. The browser decides what is best for the user.

The fetchpriority property allows you to signal high or low priority preload fetches. This can be useful when applied to <link> elements to signal preloads that are more or less important to the user experience early in the loading process.

The effects of the hint on resource loading is browser-specific so make sure to test on multiple browser engines.

Use it sparingly for exceptional cases where the browser may not be able to infer the best way to load the resource automatically. Over use can result in degrading performance.

Examples

var preloadLink = document.createElement("link");
preloadLink.href = "myimage.jpg";
preloadLink.rel = "preload";
preloadLink.as = "image";
preloadLink.fetchpriority = "high";
document.head.appendChild(preloadLink);

Specifications

Specification
Priority Hints
# link

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
fetchpriority
101
101
No
No
No
No
101
101
No
No
No
No

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/fetchpriority