从相机拍摄照片后,这些路径就会出现。
file:///data/data/xxx.xxx.xxx.xxx/files/1542782360167.jpg
我使用的是WebView为2.2.3的Ionic 4,通过应用可以观察到所有类型的答复,但没有效果。
"cordova-plugin-ionic-webview": "2.2.3"
我曾经回答过这个
Not allowed to load local resource: ionic 3 android
因此,我没有在设备上显示该应用程序,并且此应用程序不相同。
Failed to load resource: net::ERR_FILE_NOT_FOUND
答案 0 :(得分:1)
我找到了解决问题的方法。
我已经完成了此链接,该链接非常正常。
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
我的建议将以上链接用于同类问题...
答案 1 :(得分:0)
请尝试将其添加到您的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="*"/>