【发布时间】:2017-11-10 09:20:28
【问题描述】:
我刚刚安装了 MAMP 并在 htdocs 文件夹中创建了 2 个文件:
-
index.html
<!doctype html> <html> <body>Test Page</body> <script src="script.js"></script> </html> -
script.js
console.log("works");
MAMP 配置为以下端口:
- Apache 端口:8888
- Nginx 端口:7888
- MySQL 端口:8889
打开localhost:8888 在控制台中出现以下错误:
拒绝加载脚本“http://localhost:8888/script.js”,因为它违反了以下内容安全策略指令:“script-src 'none'”。
我以前从未遇到过 CSP,所以这让我感到困惑。是什么导致了这个问题?
【问题讨论】:
标签: javascript html apache mamp content-security-policy