Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Introduction to jQuery Hello, jQuery! Accessing and Modifying Attributes

Louis Rosenstein
Louis Rosenstein
6,343 Points

integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous" what does this mean?

<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous"></script>

What is "integrity" and "crossorigin" ?

2 Answers

Steven Parker
Steven Parker
229,783 Points

Both attributes are used to implement Subresource Integrity.

Subresource Integrity is a mechanism by which user agents may verify that a fetched resource has been delivered without unexpected or unauthorized modification.

The integrity attribute allows the browser to check the source file contents against the supplied hash value to ensure that the code is never loaded if the source has been modified.

The crossorigin attribute indicates if and how the CORS (Cross-Origin Resource Sharing) credential-passing mechanism will be used.

Yeah, I love markdown features a lot...