@ionic/angular 4.0.0-beta.13 : Not allowed to load local resource : with webview 2.2.3 - Ionic CLI 4.3.1

梦想的初衷 提交于 2019-11-26 17:52:04

问题


After taking the photo from camera, these paths come.

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

I use Ionic 4 in which WebView is 2.2.3, all types of replies have been observed by applying but no effects came.

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

I used to answer this one

Not allowed to load local resource: ionic 3 android

So I do not show the application on the device and this one is not the same.

Failed to load resource: net::ERR_FILE_NOT_FOUND

回答1:


I have found the solution of my problem.

I have done this link which is working perfectly.

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

And in my config.xml, extra did not write anything.

inshort : new webview plugin are not support file:/// url

first convert url into http://localhost:<post>/url using this function this.webview.convertFileSrc(img);

return this function value like this http://localhost:8080/_file_/data/data/xxx.xxx.xxx.xxx/files/1542782360167.jpg

my suggestion use above link for same kind of problem...




回答2:


Please try add this to your 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="*"/>


来源:https://stackoverflow.com/questions/53395712/ionic-angular-4-0-0-beta-13-not-allowed-to-load-local-resource-with-webview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!