HTMLScriptElement: integrity プロパティ
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2018年4月.
integrity
は HTMLScriptElement
インターフェイスのプロパティで、取得されたリソースが予期せぬ改変なしに配信されたことを確認するためにブラウザーが使用することができる、インラインメタデータを格納する文字列です。
これは <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> # dom-script-integrity> |
ブラウザーの互換性
Loading…