admin管理员组文章数量:1353261
Using cdn from bootstrap pages causing this error on all my bootstrap pages
<script src=".js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
Failed to find a valid digest in the 'integrity' attribute for resource '.js/1.14.3/umd/popper.min.js' with puted SHA-256 integrity 'f/3u5OOj9c7fUgL5NEWK2U65jTKCMSzCWp6P+l+eKGI='. The resource has been blocked.
if you are using bootstrap in any of your projects this error might also be visible to you
Using cdn from bootstrap pages causing this error on all my bootstrap pages
<script src="https://cdnjs.cloudflare./ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
Failed to find a valid digest in the 'integrity' attribute for resource 'https://cdnjs.cloudflare./ajax/libs/popper.js/1.14.3/umd/popper.min.js' with puted SHA-256 integrity 'f/3u5OOj9c7fUgL5NEWK2U65jTKCMSzCWp6P+l+eKGI='. The resource has been blocked.
if you are using bootstrap in any of your projects this error might also be visible to you
Share Improve this question edited Nov 10, 2018 at 14:51 Sanjay asked Nov 10, 2018 at 14:32 SanjaySanjay 1,0171 gold badge15 silver badges24 bronze badges 1- github./twbs/bootstrap/issues/27645 i had raised this issue here – Sanjay Commented Nov 10, 2018 at 14:53
5 Answers
Reset to default 1That appears to be an out dated include snippet for popper.
Currently, the latest Bootstrap documentation shows this to be their popper snippet
<script src="https://cdnjs.cloudflare./ajax/libs/popper.js/1.14.0/umd/popper.min.js"
integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ"
crossorigin="anonymous"></script>
If you wanted to include the version you have currently listed, you could drop the integrity attribute altogether like so (you can read about what that attribute does here What are the integrity and crossorigin attributes?)
<script src="https://cdnjs.cloudflare./ajax/libs/popper.js/1.14.3/umd/popper.min.js"
crossorigin="anonymous"></script>
It looks like it also may be the case that your browser doesn't support the sha384 hash as a valid digest, so you could also update the digest to one your browser will support like this
<script src="https://cdnjs.cloudflare./ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha256-f/3u5OOj9c7fUgL5NEWK2U65jTKCMSzCWp6P+l+eKGI="
crossorigin="anonymous"></script>
I had the same problem with the *.js files locally stored in git. Git changed the end-of-line from LF (unix) to CRFL (windows). The HASH is not valid after that.
In this case, you need to tell git to keep eol as needed using a file .gitattributes with lines of type:
/my/path/to/file.js eol=lf
Use the mand dos2unix on the file before mit to fix the file.
If the above solutions do not work for you, try following steps which worked for me:
Visit the Bootstrap website corresponding to your current version.
Locate the 'src' field within the script tag and copy the provided URL. For instance:
<script src="https://cdn.jsdelivr/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
From this script tag, extract and copy the URL: https://cdn.jsdelivr/npm/[email protected]/dist/umd/popper.min.js
Paste the copied URL into your browser, download the file, and replace your existing file if you are using the downloaded dependency. Alternatively, directly replace the script tag in your code with the one provided above.
Copy the SHA checksum from the same script tag and use it as the value for the integrity field in your code.
By following these steps, you should be able to resolve the issue you are facing.
I had a similar issue and just ended up removing the integrity tag to every script and link tag.
It solved my problem. I don't think there's much we can do on our end here if we are using CDN service.
Just remove the integrity taggs. Helpt me and it does not change anything on your site.
本文标签:
版权声明:本文标题:javascript - Bootstrap popper.js Failed to find a valid digest in the 'integrity' attribute for resource - Stack 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743874819a2554137.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论