HTMLScriptElement: integrity-Eigenschaft
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2018.
Die integrity-Eigenschaft des HTMLScriptElement-Interfaces ist ein String, der Inline-Metadaten enthält, die ein Browser verwenden kann, um zu überprüfen, dass eine abgefragte Ressource ohne unerwartete Manipulationen geliefert wurde.
Sie spiegelt das integrity-Attribut des <script>-Elements wider.
Wert
Ein String.
Beispiele
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); // Output: "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC"
Spezifikationen
| Specification |
|---|
| HTML> # dom-script-integrity> |
Browser-Kompatibilität
Loading…