Problem:
In my application, I want to access the image through cordova wkwebview. The HTML element is as follows.
<img src="cdvfile://localhost/library-nosync/MyFolder/file.jpg">
When loading, I get the error message "Unable to load resource: Unsupported URL." I work with iOS 10.2.
Checked / checked things:
If the list of files present in the folder "cordova.file.dataDirectory" in the folder "MyFolder" is checked, I see "file.jpg" there. It has its own URL: File: ./// var / mobile / Containers / Data / Application / app_id / Library / NoCloud / MyFolder / file.jpg
I added "img-src" self 'cdvfile: "to Content-Security-Policy.
I added the following to config.xml
<access origin="cdvfile://*" /> <allow-navigation href="cdvfile://*" /> <allow-intent href="cdvfile://*" /> <preference name="iosPersistentFileLocation" value="Compatibility" /> <preference name="iosExtraFilesystems" value="library,library-nosync,documents,documents-nosync,cache,bundle,root" />
There are no special (non-ASCII) characters in the URL, as indicated in the streams associated with this error. What else could be causing the "Unsupported URL" ?.
I'm trying to access cdvfile: // path wrong?
Update
I stumbled upon a link (I forgot to capture it), stating that web browsing needs a relative path and therefore cdvfile: // will not work. I tried to change the image source to a relative path, changing it to "../../../../../../../../..//var/mobile/Containers/Data/Application /app-id/Library/NoCloud/MyFolder/file.jpg ", and now I see a new error -" Could not load resource: operation could not be completed. Operation not allowed "
I could get the image to work by reading the contents of the file and passing the base64 data as the image source. But this is not as it should be if?