HTMLScriptElement: integrity プロパティ

integrityHTMLScriptElement インターフェイスのプロパティで、取得されたリソースが予期せぬ改変なしに配信されたことを確認するためにブラウザーが使用することができる、インラインメタデータを格納する文字列です。

これは <script> 要素の integrity 属性を反映したものです。

文字列です。

html
<script
  id="el"
  src="https://example.com/example-framework.js"
  type="text/javascript"
  integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC"
  crossorigin="anonymous"></script>
js
const el = document.getElementById("el");
console.log(el.integrity); // 出力: "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC"

仕様書

Specification
HTML Standard
# dom-script-integrity

ブラウザーの互換性

BCD tables only load in the browser

関連情報