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