Browser & Web Performance · Middle · Question 57 of 75

What does the integrity attribute (Subresource Integrity) protect against?

<script src="https://cdn.example.com/lib.js"
  integrity="sha384-..." crossorigin="anonymous"></script>

Explanation

The hash pins the exact file contents. It's mainly useful for versioned third-party files that never change.

Further reading

Problem with a question

Browser & Web Performance · Middle · question 57

Test yourself

Take the Browser & Web Performance · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz