Find centralized, trusted content and collaborate around the technologies you use most.
Connect and share knowledge within a single location that is structured and easy to search.
I am working on an example web app that I want my users to be able to install to their chrome home screen. As far as I can tell, all of the following criteria are met:
I'm registering a service worker with a fetch handler:
importScripts("/precache-manifest.2dbaa71ff348edf029d7ff098089b7cd.js", "/workbox-v3.3.1/workbox-sw.js");
workbox.setConfig({modulePathPrefix: "/workbox-v3.3.1"});
/* eslint-disable */
self.__precacheManifest = [].concat(self.__precacheManifest || []);
workbox.precaching.suppressWarnings();
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
self.addEventListener('fetch', (e) => {
console.log(e);
S, the problem that I'm running into, is that the
beforeinstallprompt
event is never firing for me to do anything with. I've run my app through Lighthouse at least a dozen times, and every single time I get the same error:
Failures: Service worker does not successfully serve the manifest’s start_url, No start URL to fetch: No usable web app manifest on page…
And I'm officially at a loss for why this isn't working.
–
Best way to diagnose your issue would be by using "Audits" (lighthouse) available from the Chrome Dev Tools Audits tab.
Try to run the "Progressive Web App" mobile audit, the results should give you a clue for what needs fixing.
First, try it on another device if possible.
Do you have a URL you could share? I could test if you like.
Using the lighthouse audit tool
Under #4 do you see "User can be prompted to Install the Web App"
Sometimes you get some errors, but it still works
You may want to try adding a scope attribute
Looks like if that's not there, it looks @ start_url
https://www.w3.org/TR/appmanifest/#navigation-scope
My example
http://a2hs.glitch.me/manifest.json
Strangely, for me Lighthouse is showing + result for prompting user to install app. It ISN'T working on chrome 65 Android 6. Check screenshot for my Lighthouse results.
https://imgur.com/a/vJxfNAJ
Also, I've added scope, start_url, everything in case.
Besides, when I manually trigger "Add To Home Screen" from Dev Tool, it then prompts all fine. Sigh! already spent hours already wasting time.
It nicely prompts in firefox though.
My stack is standard
gatsby v2
with 2 plugins here
https://www.gatsbyjs.org/docs/progressive-web-app/
–
–
Thanks for contributing an answer to Stack Overflow!
-
Please be sure to
answer the question
. Provide details and share your research!
But
avoid
…
-
Asking for help, clarification, or responding to other answers.
-
Making statements based on opinion; back them up with references or personal experience.
To learn more, see our
tips on writing great answers
.