Back to Content

HTMLScriptElement: fetchPriority property

files/en-us/web/api/htmlscriptelement/fetchpriority/index.md

latest1.1 KB
Original Source

{{APIRef("HTML DOM")}}

The fetchPriority property of the {{domxref("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

{{Specifications}}

Browser compatibility

{{Compat}}

See also