Description
This plugin is supposed to allow to load images via:
<img src="cdvfile://localhost/assets/www/images/img.svg" />
on android
<img src="cdvfile://localhost/bundle/www/images/img.svg" />
on ios,
if the csp tag has cdvfiile://* whitelisted for img-src.
However when using this from a remotely https loaded page its considered "mixed content" and ios warns about it but android totally blocks it with the error:
Mixed Content: The page at 'https://www.site.com' was loaded over HTTPS, but requested an insecure image 'cdvfile://localhost/assets/www/images/img.svg'. This request has been blocked; the content must be served over HTTPS.
Is there any way to bypass this using some config.xml whitelisting tags?
allow-intent and allow-navigation tags have anything to do with this?
I had the following in config.xml:
<access origin="*" />
<access origin="cdvfile://*" />
Or is cdvfile not supported for https loaded remote pages? In that case I suggest to write a note about this in the cdvfile documentation which currently says nothing about it.
NOTE: For script loading this error happens on ios too because scripts are not passive content, see:
https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content#Mixed_passivedisplay_content
UPDATE1: On android after changing webview mixed content policy there is a new error: net::ERR_UNKNOWN_URL_SCHEME
(mixed content policy changed using https://developer.android.com/reference/android/webkit/WebSettings.html#MIXED_CONTENT_ALWAYS_ALLOW)
UPDATE2: Works on android and ERR_UNKNOWN_URL_SCHEME is solved because was caused by wrong local url (cdvfile://localhost/bundle instead of cdvfile://localhost/assets) so fixing the url solved it and now it works on android. In general the LocalFilesystemURL handles files if path is correct and if path is not correct then it doesn't handle the url scheme at all causing android to throw ERR_UNKNOWN_URL_SCHEME error. I think this is unexpected and LocalFilesystemURL should handle cdvfile even if path is incorrect.
NOTE: The following IS NOT NEEDED for cdvfile to work on android:
<allow-intent href="cdvfile://*" />