【发布时间】:2018-08-14 17:05:46
【问题描述】:
我正在 github 页面上测试我的 Angular 5 应用程序,每当我重新加载 index.html 以外的页面时,我都会收到此错误:
Refused to load the image 'https://sebamed.github.io/favicon.ico' because it violates the following Content Security Policy directive: "img-src data:".
另外,当我尝试访问“404”错误页面时,我收到了相同的消息。
现在,我尝试了几种解决方案,但似乎都没有奏效。我什至将它添加到我的 index.html 中:
<meta http-equiv="Content-Security-Policy" content="img-src * 'self' data: https:">
但什么也没发生。
我已将默认的 Angular 5 favicon.ico 更改为我自己的,将其放在我的资产文件夹中,并在 index.html 中为其设置相对路径(浏览器成功识别它!):
<link rel="icon" type="image/x-icon" href="/pokedex/assets/png/favicon.ico">
这个问题有什么解决办法吗?我以前从来没有过...
我的应用链接是here
编辑:
手动导航到 my-pokedex 组件后我的应用程序的屏幕截图,存储在 /mypokedex 路由中! (当我通过应用侧边栏导航到 my-pokedex 时,它可以正常工作!):
【问题讨论】:
标签: angular angular5 content-security-policy