HTMLScriptElement: integrity 屬性
integrity 屬性是 HTMLScriptElement 介面的一個字串屬性,它包含瀏覽器可以用來驗證獲取的資源是否在傳輸過程中未被意外篡改的內聯元資料。
它反映了 <script> 元素的 integrity 屬性。
值
字串。
示例
html
<script
id="el"
src="https://example.com/example-framework.js"
type="text/javascript"
crossorigin="anonymous"></script>
js
const el = document.getElementById("el");
console.log(el.integrity); // Output: "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC"
規範
| 規範 |
|---|
| HTML # dom-script-integrity |
瀏覽器相容性
載入中…