HTML DOM
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
<script id="el" type="module" src="main.js" fetchpriority="high"></script>
const el = document.getElementById("el");
console.log(el.fetchPriority); // Output: "high"
Specifications
Browser compatibility
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.
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
