-->

@ionic/angular 4.0.0-beta.13 : Not allowed to load

2019-01-09 17:29发布

问题:

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="*"/>