![](/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.