How to solve the integrity attribute problem on bootstrap.min.css

I use boot icons in my project which gives me an error

Integrity Subresource: The resource ' http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css ' has an integrity attribute, but the resource requires a request to be CORS enabled for integrity checking, but it is not. The resource has been locked because integrity cannot be applied.

Can someone help me solve this problem, and when we move on to production, the icon will not be loaded.

So, I use the link below for boot icons

%link{:href => "http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css", :integrity => "sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7", :rel => "stylesheet"}/ 
+5
source share
2 answers

I think you are missing crossorigin="anonymous" .

 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> 

If the request does not comply with the “Same Outcome” policy, then the cross-tag attribute MUST be present for the integrity of the file being checked. With the integrity established by its external origin and the missing crosshorigin, the browser will select "fail-open", which means that it will load the resource as if the integrity attribute was not set.

A source

+7
source

I tried to insert jQuery into the page through the Chrome DevTools console and I was getting this error. Here is the code I used:

 let script = document.createElement('script'); script.src = 'https://code.jquery.com/jquery-3.2.1.min.js'; script.crossorigin = 'anonymous'; script.integrity = 'sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4='; document.head.appendChild(script); 

The solution was to change crossorigin to crossorigin :

 let script = document.createElement('script'); script.src = 'https://code.jquery.com/jquery-3.2.1.min.js'; script.crossorigin = 'anonymous'; script.integrity = 'sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4='; document.head.appendChild(script); 
0
source

Source: https://habr.com/ru/post/1242724/


All Articles