[英]@ionic/angular 4.0.0-beta.13 : Not allowed to load local resource : with webview 2.2.3 - Ionic CLI 4.3.1
从相机拍摄照片后,这些路径就来了。
file:///data/data/xxx.xxx.xxx.xxx/files/1542782360167.jpg
我使用Ionic 4,其中WebView 为2.2.3,通过应用观察到所有类型的回复,但没有效果。
"cordova-plugin-ionic-webview": "2.2.3"
我曾经回答过这个
所以我没有在设备上显示应用程序,这个应用程序不一样。
Failed to load resource: net::ERR_FILE_NOT_FOUND
我已经找到了我的问题的解决方案。
我已经完成了这个链接,它工作得很好。
https://devdactic.com/ionic-4-image-upload-storage/
而在我的 config.xml 中,extra 没有写任何东西。
总之:新的 webview 插件不支持file:/// url
首先使用this.webview.convertFileSrc(img);
函数将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="*"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.