内容安全策略指令:“script-src 'none' 违规错误

Content Security Policy directive: "script-src 'none' Violation Error

我刚刚安装了 MAMP 并在 htdocs 文件夹中创建了 2 个文件:

MAMP 配置到以下端口:

打开 localhost:8888 在控制台中出现以下错误:

Refused to load the script 'http://localhost:8888/script.js' because it violates the following Content Security Policy directive: "script-src 'none'".

我以前从未接触过CSP,所以这让我感到困惑。是什么导致了这个问题?

原来这个问题的原因是打开了浏览器 ScriptSafe 扩展。禁用它解决了问题

我之前在浏览器中关闭了 javascript,但忘了重新打开。这很愚蠢,但我在这里回复,以便像我这样的人可以查看!