Make app installable with sw fetch
Make app installable by adding an empty fetch
handler to the Service Worker.
Part of https://gitlab.com/gitlab-org/gitter/webapp/-/issues/1992 and gitlab-com/www-gitlab-com#7652 (closed)
We added the web app manifest file in https://gitlab.com/gitlab-org/gitter/webapp/-/merge_requests/1946
Chrome suggesting to install/add to homescreen: | After installing, you can open Gitter in a standalone window and it has a taskbar icon: |
---|---|
Dev notes
- Criteria for being installable: https://web.dev/install-criteria/
- The web app is not already installed
- Meets a user engagement heuristic
- Be served over HTTPS
- Includes a Web App Manifest that includes:
- short_name or name
- icons - must include a 192px and a 512px icon
- start_url
- display - must be one of fullscreen, standalone, or minimal-ui
- Note: prefer_related_applications must not be present, or be false
- Registers a service worker with a functional fetch handler
Testing strategy
- Enable the service worker by turning on the feature toggle -> http://localhost:5000/api_web/features/web-push/1
- Visit the site and wait 10 seconds for the Service Worker to be installed, http://localhost:5000
- Click the add to homescreen button (For Chrome, it's in the browser address bar)
-
🎉 Standalone Gitter window with taskbar icon
Edited by Eric Eastwood