Home > OS >  I have a red line under the script tag when linking to jquery
I have a red line under the script tag when linking to jquery

Time:10-28

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

Here is the code

Here is what it says on the with red line under

CodePudding user response:

You need to specify a crossorigin HTML attribute on your script tag.

<script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"/></script>

CodePudding user response:

How to include jQuery from jQuery CDN: https://code.jquery.com/

<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>
  • Related