[BUG] An erroneous . is added to end of PWA web address in Android apk
Closed this issue ยท 10 comments
Describe the bug
I created Store packages for my PWA by pointing PWABuilder to pwa.kiwix.org/www/index.html
. The Windows msix package created from this works just fine. Testing the Android .apk on my phone, the app installs correctly (after fighting Play Protect...), but on launching the app, I get a 404 Not Found page showing in the app. When I look carefully at the URL, I notice that it is pwa.kiwix.org/www/index.html.
with that erroneous period/full-stop at the end (see screenshot). I click three dots, and choose "Open in Microsoft Edge", and the same erroneous page opens in Edge for Android. In Edge (but not in the app), I can edit the URL and remove the period, in which case the page loads correctly.
Steps to reproduce
- Open PWABuilder and point it to
pwa.kiwix.org/www/index.html
. It will tell you that the PWA has a score of 150 points. - Create package for Android
- Download package, unzip and install apk
- Run the installed app
Expected behavior
My PWA should work on Android.
Screenshots
Additional info:
- OS: Windows 10 (Android 11)
- Browser Microsoft Edge
- Version 91.0
Hello Jaifroid, thank you for opening an issue with us!
I have automatically added a "needs triage" label to help get things started. Our team will investigate the issue and help solve it ASAP. Other community members may also look into the issue and provide feedback ๐
I'm able to repro. Investigating...
I've found the cause of the issue. Submitting a PR now.
OK, so there were 2 problems here:
- PWABuilder wasn't properly handling relative paths in certain scenarios.
- You're putting the wrong URL into PWABuilder.
I'm submitting a PR for the first item.
But for the second item, your PWA URL is actually https://pwa.kiwix.org. Specifically, your manifest is https://pwa.kiwix.org/manifest.json, and it's start_url is set to "." - so your PWA "real" URL is new URL(".", "https://pwa.kiwix.org/manifest.json")
= "https://pwa.kiwix.org".
So, that's the URL you should put into PWABuilder., https://pwa.kiwix.org
I'm submitting a PR to patch up this issue to prevent it from happening in the first place. The fix should be in place by tomorrow (Thursday)
Thank you for the quick fix @JudahGabriel! I did actually try pwa.kiwix.org
as the URL at first, but it told me I didn't have a manifest. I can simulate this still in Firefox (see screenshot below).
Now tyring that URL on in Microsoft Edge, the code gets stuck on "If your app does not have a Web Manifest, we are generating one for you...", but your fix may not be in there yet.
If I put in pwa.kiwix.org/www/index.html
, then I get a very quick "Total Score 150... Congrats! You have a great PWA!". pwa.kiwix.org/www/
also works.
Oddly, pwa.kiwix.org
works in Edge after I try the direct version, but not if I open PWABuilder fresh and paste in 'pwa.kiwix.org'. Perhaps PWABuilder fails to follow the redirect in pwa.kiwix.org/index.html
(it contains <meta http-equiv="refresh" content="0; url=www/index.html">
), but then caches it the second time. I'm guessing.
Ah, I see our manifest detector wasn't handling URL redirection in the <head>
. I'll update that so that things will work as expected.
I've updated PWABuilder's manifest finding logic to check for HTML-based redirects. Here's the URL that tries to find your manifest: https://pwabuilder-manifest-finder.azurewebsites.net/api/findmanifest?url=https://pwa.kiwix.org
You'll see it now successfully detects your manifest.
Go back to PWABuilder, put https://pwa.kiwix.org into PWABuilder, and things should work this time. ๐
Great, that works now! Thank you @JudahGabriel for fixing it so quickly.