script标签:integrity属性
用途:为了防止cdn篡改JavaScript而使用
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
HTML5 crossorigin属性
使用步骤:
1、在html标签中加入了crosserigin = "anonymous"属性;
2、html标签中的src属性的资源服务器也需要开启cors验证,并允许引用页面域名访问,否则无法加载这个js.
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>