我设置了内容安全政策,Chrome对此非常满意。 Firefox虽然会在控制台中显示这些错误。
这些行号不指向脚本(例如1:1只是<!DOCTYPE html>
)。
如何确定Firefox抱怨的脚本是什么?
Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). xxx.com:1:1
Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). xxx.com:3:4629
答案 0 :(得分:0)
这是一个NoScript问题。告诉NoScript允许脚本。
这与文档的位置有关,并且显然与文档的内容无关。
我可以使用以下HTML小片段在本地文件系统(file:///tmp/test.html
)上重现该问题:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head><body>test</body>
</html>
(请注意缺少脚本。<meta>
标签仅用于抑制字符编码投诉。)
当我告诉NoScript允许来自file:
的脚本并刷新页面时,策略通知就消失了。