Refused to execute inline script because it violates the following Content Secur
问题描述
- 有一个单独的html文件里面使用了cdn引入了外部的js文件,如下:
<script src="abc.cdn.xxx.js"></script>
- 控制台直接报错,但是不影响代码运行
- 报错信息如下:
Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'wasm-unsafe-eval' 'inline-speculation-rules' chrome-extension://c74ed397-0031-4064-bf05-2ac404af2ff8/". Either the 'unsafe-inline' keyword, a hash ('sha256-SqqFyeG2nBtCbs3Zgdc/cA8HYzuwepPEQDZzDjgb/vQ='), or a nonce ('nonce-...') is required to enable inline execution.
报错截图如下:

原因和解决方案
