我正在托管我的网页,用于phonegap构建应用程序。 我想用相机上传照片,并显示预览图像,基本上是这样:“不允许加载本地资源”从PhoneGap中的远程页面的本地图像构建
<img src="file:///storage/emulated/0/Android/data/com.myapp.myapp/cache/1470418568917.jpg" height="500" />
因为我的网页托管我得到这个错误:
不允许加载本地资源:file:///storage/emulated/0/Android/data/com.myapp.myapp/cache/1470418568917.jpg“,来源:https://www.myapp.com/v5.5/imager.html#
我假设这是一些CORS问题,所以我已将此添加到页面的html中
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'; media-src *; img-src * filesystem: data:">
,这对我的config.xml中(我用的PhoneGap构建)
<plugin name="cordova-plugin-whitelist" source="npm" />
<allow-navigation href="*" />
<allow-navigation href="*://*/*" />
<allow-navigation href="file:///*/*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<allow-navigation href="data:*" />
<allow-intent href="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<access origin="*" />
<access origin="*://*/*" />
<access origin="file:///*" />
<access origin="cdvfile://*" />
<access origin="content:///*" />
正如你可以看到我已经想尽设置我能想到的,从网上淘。 我错过了一些明显的东西吗?
在此先感谢。
顺便说一句,在双方的iOS出现错误和Android –