HTMLScriptElement: thuộc tính fetchPriority
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.
Thuộc tính fetchPriority của giao diện HTMLScriptElement biểu diễn gợi ý cho trình duyệt về cách ưu tiên tìm nạp tập lệnh ngoài so với các tập lệnh ngoài khác.
Nó phản ánh thuộc tính nội dung fetchpriority của phần tử <script>.
Giá trị
Một chuỗi. Các giá trị được phép, xem thuộc tính HTML fetchpriority.
Ví dụ
html
<script id="el" type="module" src="main.js" fetchpriority="high"></script>
js
const el = document.getElementById("el");
console.log(el.fetchPriority); // Kết quả: "high"
Thông số kỹ thuật
| Specification |
|---|
| HTML> # dom-script-fetchpriority> |
Tương thích trình duyệt
Xem thêm
HTMLImageElement.fetchPriorityHTMLLinkElement.fetchPriority- HTTP
Linkheader - Tối ưu hóa tải tài nguyên với Fetch Priority API để biết thông tin về cách API này ảnh hưởng đến ưu tiên trên Chrome.