-
-
Notifications
You must be signed in to change notification settings - Fork 772
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
Failing to process map tiles in Android Webview when run from the "asset" folder #4451
Comments
I'm using Capacitor, and it doesn't have this issue. I would suggest creating a small webserver on android like done with Capacitor to solve this issue. |
I appreciate this may be an issue specific to GeckoView and a Chromium-based WebView may be fine, but, why not support both? It seems overkill to have to implement a webserver when the intention appears to be to support file:// based access, it's just using Mozilla on Android, this presents with the origin as "resource://android" rather than "file://". |
Can you configure GeckoView to behave like a "regular" browser and serve files with the "file://" protocol? This is not the only place where file protocol is checked and expected, and I don't think there's a need to patch all these places because the GeckoView decided to implement this differently from other browsers... |
I'm afraid not. If Firefox or GeckoView are to be supported, a change needs to be made. It looks like this code was already modded to make it work with Chrome/Chromium in: It just needs a tweak to work with Firefox/GeckoView too. Interestingly, this used to work pre v4 just fine. It looks like this change: Due to this issue: ...broken file access using Firefox. |
The two places I know that use file protocol are in ajax code and the actor. |
In Actor.receive() there is a check for the origin/location.
However, if running on Android using some WebView implementations (such as Mozilla's GeckoView) and running from the Android asset folder (which is really just "file://"), the data.origin is actually set to "resource://android".
That is, the following line:
if (data.origin !== 'file://' && location.origin !== 'file://' && data.origin !== location.origin) {
Should be extended to be:
if (data.origin !== 'file://' && location.origin !== 'file://' && data.origin !== 'resource://android' && location.origin !== "resource://android" && data.origin !== location.origin) {
As, otherwise, no map tiles are loaded and displayed.
Many thanks.
The text was updated successfully, but these errors were encountered: