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 |
浏览器兼容性
加载中…