添加 Firefox 内容安全策略 on/extension
Firefox Content Security Policy in Add on/extension
我在控制台中收到消息 'Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”).'。
我的分机结构如下:
jquery.min.js,
manifest.json,
options.html,
potato.png,
script.js,
我认为我的 options.html 的 header 是问题所在:
<head>
<title>Rotten Potatoes</title>
<script src="jquery.min.js"></script>
<script src="script.js"></script>
<link rel="shortcut icon" type="image/png" href="potato.png"/>
</head>
有人知道如何摆脱这个吗?也许通过清单?
您正在访问的站点有阻止此脚本内联注入的限制。尝试查看您正在访问的站点返回的 headers,看看它是否包含任何 CSP(内容安全策略)headers。我还注意到您包括第 3 方库,它们可能有第 3 方脚本被来源一起阻止。
您的错误具体来自 header:
Content-Security-Policy: script-src *;
这里有一些参考资料,您可以阅读以了解这里发生的事情。
参考文献:
我在控制台中收到消息 'Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”).'。
我的分机结构如下:
jquery.min.js,
manifest.json,
options.html,
potato.png,
script.js,
我认为我的 options.html 的 header 是问题所在:
<head>
<title>Rotten Potatoes</title>
<script src="jquery.min.js"></script>
<script src="script.js"></script>
<link rel="shortcut icon" type="image/png" href="potato.png"/>
</head>
有人知道如何摆脱这个吗?也许通过清单?
您正在访问的站点有阻止此脚本内联注入的限制。尝试查看您正在访问的站点返回的 headers,看看它是否包含任何 CSP(内容安全策略)headers。我还注意到您包括第 3 方库,它们可能有第 3 方脚本被来源一起阻止。
您的错误具体来自 header:
Content-Security-Policy: script-src *;
这里有一些参考资料,您可以阅读以了解这里发生的事情。
参考文献: