HTMLScriptElement: fetchPriority property
Baseline 2024Newly available
Since October 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
ThefetchPriority property of theHTMLScriptElement interface represents a hint to the browser indicating how it should prioritize fetching an external script relative to other external scripts.It reflects the<script> element'sfetchpriority content attribute.
In this article
Value
A string. For the permitted values, see the HTMLfetchpriority attribute.
Examples
html
<script type="module" src="main.js" fetchpriority="high"></script>js
const el = document.getElementById("el");console.log(el.fetchPriority); // Output: "high"Specifications
| Specification |
|---|
| HTML> # dom-script-fetchpriority> |
Browser compatibility
See also
HTMLImageElement.fetchPriorityHTMLLinkElement.fetchPriority- HTTP
Linkheader - Optimize resource loading with the Fetch Priority API for information about how this API affects priorities on Chrome.