- Courses
- HTML
- HTML top level tags
- <link>
- Role of integrity in link element
What is the function of the integrity
attribute in the <link>
element?
The integrity
attribute provides a way to verify that a fetched resource has not been manipulated.
The integrity
attribute in the <link>
element contains a base64-encoded cryptographic hash of the resource. This allows the browser to check that the resource has been delivered without unexpected changes, enhancing security by ensuring that the content is exactly what the developer intended.
<link rel="stylesheet" href="style.css" integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9Gh7kq3Uqz2+7mD9k5t1p1T9t+7mD9k5t1p1T9" />