![](/img/trans.png)
[英]Chrome App : Refused to execute inline script because it violates the following Content Security Policy directive
[英]Working on CSP headers, seeing console browser as Refused to execute inline script because it violates the following Content Security Policy directive
内容安全策略的#console 浏览器问题
拒绝执行内联脚本,因为它违反了以下内容安全策略指令:“script-src 'self'”。 需要“unsafe-inline”关键字、hash(“sha256-9X08/o2ns8hEbTzT0V1Xyn6yYc8qftFOKmH3KNb8dWo=”)或随机数(“nonce-...”)才能启用内联执行。[在此处输入图像描述][1]
#Image of the error
[1]: https://i.stack.imgur.com/7R9sp.png
frame-ancestors 'self' https:
script-src 'self';
object-src 'none';
base-uri 'none';
style-src 'self' fonts.googleapis.com 'unsafe-inline';
media-src *;
img-src 'self';
该错误似乎表明使用内联脚本存在问题。 看起来像
<script>
your codes
</script>
如果您要使用内联脚本,请将 'unsafe-line' 添加到 script-src 指令。
当前设置仅允许来自您的域的脚本。
例如)<script src="/yourDomain/public/yourScript.js">
'self' 的 script-src 指令仅允许将脚本作为来自同一域的脚本文件加载。 您的页面还包含需要在 CSP 中获得权限才能运行的内联脚本。 你有几个选择:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.