-
Notifications
You must be signed in to change notification settings - Fork 759
feat(android): Allow loading of local file using "https://cdvfile/" #322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Rerun tests. |
This change should probably be added to the documentation/README somehow so people can discover it. |
Thanks. Now on to testing this, what does "in a WebView that is loaded over https" mean exactly? Navigate the webview to a website that uses |
The former. |
Ok, repro:
Observations:
Test PR:
Observations:
So I would say this works as designed, correct? What tripped me up a bit is that the |
Yeah I guess you're right. Shall I make the change to |
Without the typo I introduced, then yeah ;) (Similar discussion in the iOS PR which currently does a totally different thing: #296 (comment) - we have to unify on one pattern there.) |
I dont think https://cdvfile/ is a good idea as it is a malformed non-standard url in web context. We are talking about loading a standard https website in a webview so no reason to force that website to use https://cdvfile/ I think. The idea is that if the remote website loads in web context then it loads resources from remote server but if it loads SAME URL from inside the app webview then the app will intercept and return local content. It should work for normal urls. |
Furthermore, if we force the site to load content from a different domain, then we can get into other issues of cross domain requests. If we allow the content to be loaded from same domain as remote https site (intercepted loading) then we avoid those problems. |
Done. |
This change will make this unusable I believe because of cross domain requests |
It seems to be working for me from https site. Are there any issues outstanding with this? |
Yes, the iOS side and how these two compare: #295 (comment) |
OK thanks, please let me know if you have any testing. Would love to get this working at my end (only problem seems to be iOS for me right now) |
I do prefer the idea from the iOS PR (#296) as it prevents CORS issues. |
We can't really support this kind of configuration. It's against the iOS terms to load in local resources from a remote site. Doing so is a security risk because one could load in the For iOS this breaks Apple's terms, section 4.7 which reads:
https://developer.apple.com/app-store/review/guidelines/#third-party-software Google has similar text, however not well explained:
https://support.google.com/googleplay/android-developer/answer/9888379?hl=en&ref_topic=9877467 Do note that the Cordova webview is a webview that explicitly provides the means to access native Android APIs, therefore the mentioned restriction regarding JS in the webview does not apply to Cordova. For these reasons we cannot accept a PR that allows local access to files from remotely loaded sources. |
Platforms affected
Android
Motivation and Context
Fixes issue #295 for Android platform, without requiring to set the WebView to a less secure mixed content mode.
Description
Allows loading of local file using "
https://cdvfile/
", which the browser sees as secure, instead of "cdvfile://" which the browser sees as unsecure.Testing
npm test
Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)