Subresource Integrity
Subresource Integrity protects users by ensuring third-party resources haven't been altered.
Definition
Subresource Integrity (SRI) is a security feature that enables browsers to verify that resources fetched from a third-party source have not been tampered with. By using SRI, developers can include a integrity attribute in their HTML tags that contain a hash of the file. If the file does not match the hash, the browser will refuse to load it, protecting users from potentially malicious scripts.
This is especially important when using CDNs or third-party libraries, as it adds a layer of security to your site.
Why It Matters
Implementing Subresource Integrity is essential for SEO as it enhances site security, which is a ranking factor. Search engines prioritize secure sites that protect user data, and SRI helps maintain this integrity.
Example
For example, if you're including a JavaScript library from a CDN, you might use the following tag: <script src="https://cdn.example.com/library.js" integrity="sha384-abc123" crossorigin="anonymous"></script>. This way, the browser checks the integrity of the library before loading it.
Check if your site gets this right
Run a free audit and get AI-powered fix suggestions in 30 seconds.
Run a free audit