A website loads a script from another server. HTTPS protects the connection, but how does the browser know that the returned file is the exact version the page author intended? Subresource integrity, usually shortened to SRI, adds that separate check.
MDN’s SRI documentation explains the integrity attribute used with supported script and stylesheet resources. The page supplies a cryptographic hash. The browser computes a hash of the received resource and refuses to use it if the required integrity check fails.
A file check, not a reputation check
Think of a maintainer approving version 3 of a small library. The integrity value describes the bytes of that version. If the remote server later returns a modified file at the same address, the value no longer matches.
That is useful against an unexpected resource change. It does not establish that the approved library was harmless in the first place. Nor does it protect a page whose attacker can change both the resource reference and its expected hash.
For cross-origin resources, the hosting server must also allow the necessary CORS access. A maintainer cannot reliably add an integrity value to an arbitrary third-party URL and assume that every delivery configuration will work.
Update the resource and its evidence together
A practical maintenance routine is to pin the intended version, obtain it through a trusted release process, generate the matching hash and test the page. Keep the URL and integrity value in the same reviewed change. After deployment, inspect the browser console and test the feature that uses the file.
MDN’s implementation guide provides further setup guidance. If a legitimate update produces an integrity error, investigate the version and delivered bytes rather than removing the check merely to silence the message.
For visitors, SRI usually operates invisibly. For site owners, its value is precise: it turns “load something from this address” into “load the resource whose contents match this expectation.” That precision also means routine dependency updates need a deliberate integrity update.

