it violates the following Content Security Policy directive: "default-src 'self' http://example.com". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.


昨天再调试APP的时候,图片无法显示了,看了下控制台报错信息,发现控制台报 it violates the following Content Security Policy directive: "default-src 'self' http://example.com". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback. 这类的错误,在网上找了一些资料,发现是因为没有设置img-src的缘故,在index.html中

<meta http-equiv="Content-Security-Policy" content="default-src *;img-src 'self' data: base64; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"/>

添加,在default-src:*;后面添加
img-src 'self' data: base64;
之后,图片成功显示,问题解决。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.错误应该怎么解决? because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'". Note that 'script-src' was not explicitly set, so 'default-s 「Jenkins」- Note that 'frame-src' was not explicitly set, so 'default-src' is used as a fallback. @20210427 Electron中Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'". Refused to load the script xxxxxx because it violates the following Content Security Policy directive:"script-src 'self' xxxxxxxxxxxxx" 浏览器安全问题 解决 Jenkins 中无法展示 HTML 样式的问题,csp问题,Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self'". react route使用HashRouter和BrowserRouter的区别-Content Security Policy img-src 404(Not found) iframe because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self' 开发chrome插件报错:Refused to execute inline event handler because it violates the following Content Security Policy directive vscode electron error (Refused to execute inline event handler because it violates the following Content Security Policy directive ... 和 Uncaught ReferenceError: process is not defined)
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM