@ionic/angular 4.0.0-beta.13:不允许加载本地资源:使用webview 2.2.3-ionic



从相机拍摄完照片后,这些路径就来了。

file:///data/data/xxx.xxx.xxx.xxx/files/1542782360167.jpg

我使用Ionic 4,其中WebView为2.2.3,所有类型的回复都已通过应用进行了观察,但没有产生任何效果。

"cordova-plugin-ionic-webview": "2.2.3"

我曾经回答过这个

不允许加载本地资源:离子3安卓

所以我不在设备上显示应用程序,而这一个不一样。

Failed to load resource: net::ERR_FILE_NOT_FOUND

我已经找到了问题的解决方案。

我已经完成了这个环节,它运行得很好。

https://devdactic.com/ionic-4-image-upload-storage/

在我的config.xml中,extra没有写任何内容。

简而言之:新的webview插件不支持file:/// url

先将url转换为http://localhost:<post>/url使用此函数this.webview.convertFileSrc(img);

返回此函数值,如http://localhost:8080/_file_/data/data/xxx.xxx.xxx.xxx/files/1542782360167.jpg

我的建议是使用上面的链接来解决同样的问题。。。

请尝试将其添加到您的config.xml中:

<access allows-arbitrary-loads-for-media="true" allows-arbitrary-loads-in-web-content="true" allows-local-networking="true" origin="*"/>
<allow-navigation href="data:*"/>
<allow-navigation href="*"/>

最新更新