![](/img/trans.png)
[英]Refused to load the image because it violates the following Content Security Policy directive (favicon)
[英]Cannot GET /login on reload pages Angular 8 - Refused to load the image '/favicon.ico' because it violates the following Content Security Policy
出現此錯誤無法在頁面正文上獲取登錄名/。 如何在最新的 angular 8 應用程序中修復此錯誤。 我已經嘗試了論壇中的所有解決方案,但沒有運氣。 任何建議將不勝感激。
請注意ng serve, ng biuld --prod
中沒有編譯錯誤。 下面是 chrome 控制台錯誤。 此錯誤僅發生在服務器 url 上,不在 localhost 中。
拒絕加載圖像“serverUrL/favicon.ico”,因為它違反了以下內容安全策略指令:“default-src 'none'”。 請注意,'img-src' 沒有顯式設置,因此 'default-src' 用作后備。
嘗試這個..
方法一
方法二
方法三
更新 index.html 的 head 部分中的以下代碼
<meta http-equiv="Content-Security-Policy" content="default-src 'self'
https://yourdomain.com;">
內容安全策略 (CSP)
CSP 指令:default-src
CSP 值:'self'(將源限制為同源)
參考
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.