HTMLScriptElement: fetchPriority property
Baseline
2024
Newly available
Since October 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
The fetchPriority
property of the HTMLScriptElement
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's fetchpriority
content attribute.
Value
A string. For the permitted values, see the HTML fetchpriority
attribute.
Examples
html
<script id="el" 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
Loading…
See also
HTMLImageElement.fetchPriority
HTMLLinkElement.fetchPriority
- HTTP
Link
header - Optimize resource loading with the Fetch Priority API for information about how this API affects priorities on Chrome.