HTMLLinkElement: fetchPriority property

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{APIRef("HTML DOM")}}

The **fetchPriority** property of the {{domxref("HTMLLinkElement")}} interface represents a hint to the browser indicating how it should prioritize fetching a particular resource relative to other resources of the same type. It reflects the <link> element's [fetchpriority](/en-US/docs/Web/HTML/Reference/Elements/link#fetchpriority) content attribute.

Value

A string. For the permitted values, see the HTML [fetchpriority](/en-US/docs/Web/HTML/Reference/Attributes/fetchpriority) attribute.

Examples

js
const preloadLink = document.createElement("link");
preloadLink.href = "my-image.jpg";
preloadLink.rel = "preload";
preloadLink.as = "image";
preloadLink.fetchPriority = "high";
document.head.appendChild(preloadLink);

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{domxref("HTMLImageElement.fetchPriority")}}
  • {{domxref("HTMLScriptElement.fetchPriority")}}
  • HTTP {{httpheader("Link")}} header
  • Optimize resource loading with the Fetch Priority API for information about how this API affects priorities on Chrome.