HTML Attributes

HTML integrity attribute

Pins eligible external resources to an expected cryptographic digest. The browser rejects mismatches. Cross-origin use requires appropriate CORS support; regenerate the digest when the resource changes. Applicable elements include: <link>, <script>. Check each element’s value rules. Example uses illustrative URLs or local assets; provide the corresponding files or application endpoints when running it. Example is a markup pattern requiring the indicated component, resource or server configuration.

Formal Syntax & Structure

html syntaxhtml
integrity="sha384-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"

Parameters & Attributes

NameTypeDescription
integritysubresource integrity hash metadataPins eligible external resources to an expected cryptographic digest. The browser rejects mismatches. Cross-origin use requires appropriate CORS support; regenerate the digest when the resource changes.

Working Example

Example Snippethtml
<!-- Replace the example digest with the real SHA-384 of app.js before use. --><script src="app.js" integrity="sha384-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"></script>

Browser Compatibility

Minimum supported versions across modern rendering engines

Chrome
45
Yes
Edge
17
Yes
Firefox
43
Yes
Safari
11.1
Yes
Checked desktop BCD snapshot: integrity on script; hash-based SRI, not signature extensions. Versions denote the recorded start of support (≤ means at least that early), not a guarantee of all behavior. Unresolved mirror and preview rows omitted.
HTML Living Standard
HTML Reference