fetchpriority
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.
Thuộc tính fetchpriority cung cấp cho trình duyệt một gợi ý về mức độ ưu tiên tương đối cần dùng khi tìm nạp một tài nguyên bên ngoài. Nó hoạt động giống như thuộc tính fetchpriority cho các phần tử HTML <img> và <script>.
Bạn có thể dùng thuộc tính này với các phần tử SVG sau:
Ghi chú sử dụng
| Giá trị | high | low | auto |
|---|---|
| Giá trị mặc định | auto |
high-
Tìm nạp tài nguyên bên ngoài với mức ưu tiên cao so với các tài nguyên bên ngoài khác.
low-
Tìm nạp tài nguyên bên ngoài với mức ưu tiên thấp so với các tài nguyên bên ngoài khác.
auto-
Không đặt ưu tiên cho việc tìm nạp. Nó được dùng nếu không có giá trị nào hoặc giá trị không hợp lệ được đặt. Đây là giá trị mặc định.
Ví dụ
Ví dụ này cho thấy cách đặt mức ưu tiên của một phần tử SVG <script> thành high.
<svg
viewBox="0 0 10 10"
height="120px"
width="120px"
xmlns="http://www.w3.org/2000/svg">
<circle id="normal" cx="5" cy="5" r="4" />
<script href="./color-change.js" fetchpriority="high"></script>
</svg>
Tương thích trình duyệt
>svg.elements.feImage.fetchpriority
svg.elements.image.fetchpriority
svg.elements.script.fetchpriority
Xem thêm
- Phần tử SVG
<script> - Thuộc tính HTML
fetchpriority