I've implemented a web app with React. Now I would like to make it an installable Progressive Web App (PWA), i.e. the browser should show the default installation prompt when the user opens the app on a mobile device.
How do I achieve that?
I've implemented a web app with React. Now I would like to make it an installable Progressive Web App (PWA), i.e. the browser should show the default installation prompt when the user opens the app on a mobile device.
How do I achieve that?
First of all, you should read a general guideline on PWAs, for example, this one here: Learn PWA
In your case, you should read this section in particular: PWA installation
Both of them are required to be present in your app, so that the browser detects it as an installable PWA.
There is a starter project available with create-react-app
, which includes a working setup for an installable PWA app: https://create-react-app.dev/docs/making-a-progressive-web-app/
If you are already working on an existing React app without PWA functionality, try the following.
public/manifest.json
) and related files (for example icons if you don't have any yet) into your existing project directoryservice-worker.js
and serviceWorkerRegistration.js
index.js
file:
serviceWorkerRegistration.register();