3

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
Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
Ashish Patidar
  • 97
  • 1
  • 13
  • I also changed the image url to normalURL, but no one is working. Normal is something like this `/data/data/xxx.xxx.xxx.xxx/files/1542782360167.jpg` – Ashish Patidar Nov 21 '18 at 07:41

2 Answers2

2

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...

Ashish Patidar
  • 97
  • 1
  • 13
  • 3
    This does not work for Ionic4 on iOS 13. Path returned is > ionic://localhost/_app_file_/var/mobile/Containers/Data/Application/71F95B7D-4B08-4A74-A6AE-77946E9E5887/Library/NoCloud/d30fea00-83df-11e6-ac59-7fda303c65c4.html. – mobigaurav Feb 21 '20 at 14:55
0

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="*"/>
markof
  • 51
  • 8
  • hi @markof Your suggestion was applied, but there was no effect. – Ashish Patidar Nov 21 '18 at 09:56
  • What cordova plugin are you use for the camera ? – markof Nov 21 '18 at 10:47
  • I'm using native plugins in; These are: `"@ionic-native/camera": "^5.0.0-beta.21", "@ionic-native/core": "^5.0.0-beta.21", "@ionic-native/file": "^5.0.0-beta.21", "@ionic-native/file-path": "^5.0.0-beta.21", "@ionic-native/file-transfer": "^5.0.0-beta.21",` and cordova plugin they are: `"cordova-plugin-camera": "4.0.3", "cordova-plugin-file": "6.0.1", "cordova-plugin-file-transfer": "1.7.1", "cordova-plugin-filepath": "1.4.2",` – Ashish Patidar Nov 21 '18 at 10:59