What a PWA is
A Progressive Web App is a regular site with three additions.
- HTTPS (or
localhostduring development). A service worker only runs in a secure context. - Web App Manifest: a JSON file with the name, icons, colours and start URL.
- Service Worker: a script that sits between the page and the network, intercepts requests and can answer them from a cache.
As a result the site can be installed to the home screen, opens in its own window and keeps working without a connection. Note that a service worker has no window and no DOM; inside it the global object is self, and the Cache API is available as caches.
Manifest and installation
The manifest tells the browser how the app should look once installed. Link it from every page:
<link rel="manifest" href="/manifest.webmanifest">
<meta name="theme-color" content="#2563eb">{
"name": "Prowid Notes",
"short_name": "Notes",
"start_url": "/?source=pwa",
"scope": "/",
"display": "standalone",
"background_color": "#ffffff",
"theme_color": "#2563eb",
"icons": [
{ "src": "/icons/192.png", "sizes": "192x192", "type": "image/png" },
{ "src": "/icons/512.png", "sizes": "512x512", "type": "image/png" },
{ "src": "/icons/maskable-512.png", "sizes": "512x512",
"type": "image/png", "purpose": "maskable" }
]
}| Field | Meaning |
|---|---|
name, short_name | Full name and the short label under the icon |
start_url | The page opened from the icon; a ?source=pwa query helps analytics |
display | standalone hides the address bar; browser keeps a normal tab |
icons | 192 and 512 px are the usual minimum; maskable adapts to round or squircle shapes |
💡 Installability rules differ between browsers, so test in the target browsers. Offline work needs a service worker in any case.