Trying to link to jquery. My code works but there still is a red line under the script so i dont know what might be wrong
Asked
Active
Viewed 107 times
-2
-
This might help: [what are integrity and crossorigin attributes](https://stackoverflow.com/questions/32039568/what-are-the-integrity-and-crossorigin-attributes) – freedomn-m Oct 28 '21 at 07:46
1 Answers
0
How to include jQuery from jQuery CDN: https://code.jquery.com/
Latest jQuery 3 version:
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous"></script>
The integrity and crossorigin attributes are used for Subresource Integrity (SRI) checking. This allows browsers to ensure that resources hosted on third-party servers have not been tampered with. Use of SRI is recommended as a best-practice, whenever libraries are loaded from a third-party source.
I think all is said shortly and clearly and there's no need to add something else.
About integrity attribute of the minified version 3.3.1
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>

Reflective
- 3,854
- 1
- 13
- 25