fetchpriority
非標準:此特性未標準化。我們不建議在生產環境中使用非標準特性,因為它們瀏覽器支援有限,並且可能會更改或被移除。但是,在沒有標準選項的特定情況下,它們可以是合適的替代方案。
fetchpriority 屬性為瀏覽器提供了一個關於獲取外部資源時應使用的相對優先順序的提示。它的工作方式與 HTML 中 <img> 和 <script> 元素的 fetchpriority 屬性相同。
你可以將此屬性與以下 SVG 元素一起使用
用法說明
| 值 | high | low | auto |
|---|---|
| 預設值 | auto |
示例
此示例演示瞭如何將 SVG <script> 元素的優先順序設定為 high。
html
<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>
瀏覽器相容性
svg.elements.feImage.fetchpriority
載入中…
svg.elements.image.fetchpriority
載入中…
svg.elements.script.fetchpriority
載入中…
另見
- SVG
<script>元素 - HTML
<script>元素的fetchpriority屬性