使用cordova 压缩图片时出现的CSP问题

引入一个压缩插件时, 上传的附件需要file或blob格式, 运行时一直报错 
<meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap:">

Refused to load the image blob:'http://xxx.png'
because it violates the following Content Security Policy directive: "default-src 'self'
data: gap:
Note that 'img-src' was not explicitly set

看了一些文章后改成
<meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap:; img-src * data: ">
结果还是不行. 继续报错
Refused to load the image blob:'http://xxx.png' 
because it violates the following Content Security Policy directive: "default-src 'self' 
data: gap: img-src * data: 
 
找了半天 最后搜mdn才知道 原来属性是可以有多个的.
 
posted @ 2019-08-22 10:58  双脚灵活过双手  阅读(423)  评论(0)    收藏  举报