Progressive Web Apps Explained
What progressive web apps are, how service workers and manifests make a website installable and offline capable, and when a PWA is the right choice.
On this page
A progressive web app, or PWA, is a website that can behave like an installed application. It can sit on your home screen, open in its own window, work with a poor connection or none at all, and send updates. Yet it is still built with ordinary web technology and delivered through a browser.
The idea is to reach for the strengths of both worlds: the easy access and reach of the web, and the smoother feel of a native app. This guide explains how PWAs work and when they make sense.
The Idea Behind "Progressive"
The word progressive means the app improves as the browser allows. A basic browser still shows a normal working website. A more capable browser adds installability, offline support and other features on top. Nobody is shut out, and everyone gets the best experience their device supports.
The Three Building Blocks
Most PWAs rest on three pieces.
- HTTPS. Secure delivery is required, since the features involved are powerful and must be protected from tampering.
- A web app manifest. A small JSON file that describes the app.
- A service worker. A script that runs in the background and controls how network requests are handled.
The Web App Manifest
The manifest tells the browser how the app should look when installed. It includes the name, icons, theme color, the page to open first and how to display the app.
{
"name": "Daily Notes",
"short_name": "Notes",
"start_url": "/",
"display": "standalone",
"background_color": "#ffffff",
"theme_color": "#1a73e8",
"icons": [
{ "src": "/icon-192.png", "sizes": "192x192", "type": "image/png" },
{ "src": "/icon-512.png", "sizes": "512x512", "type": "image/png" }
]
}
The display value of standalone hides the browser's address bar so the app feels more like a separate program. You link the manifest from your HTML page with a link element.
Service Workers
A service worker is a JavaScript file that the browser runs separately from the page. It acts like a proxy between your app and the network. Because it can intercept requests, it can serve stored responses when the network is slow or missing.
A service worker goes through a lifecycle: registration, installation, activation and then control of pages. During installation, it commonly stores a set of files in a cache.
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open('app-v1').then((cache) =>
cache.addAll(['/', '/styles.css', '/app.js'])
)
);
});
self.addEventListener('fetch', (event) => {
event.respondWith(
caches.match(event.request).then((cached) => cached || fetch(event.request))
);
});
This simple example serves cached files first and falls back to the network.
Caching Strategies
How the service worker answers requests depends on the content.
- Cache first suits files that rarely change, like icons and styles.
- Network first suits data that should be fresh, falling back to the cache when offline.
- Stale while revalidate shows the cached copy at once and updates it in the background.
Choosing the right strategy for each type of file is much of the craft of building a PWA.
What PWAs Can Do
Depending on the browser and platform, a PWA can:
- Be installed from the browser to the home screen or app launcher.
- Run in its own window without browser controls.
- Work offline or on unreliable connections.
- Receive push notifications, where supported.
- Sync data in the background when the connection returns.
- Access some device features, such as the camera or location, through web APIs.
Support varies between browsers and operating systems, so test on the devices your audience uses.
Benefits
- One codebase for many platforms, instead of separate versions for each.
- No store required, so users can start with a link and updates reach everyone as soon as you deploy.
- Small installation size, compared with many native apps.
- Fast repeat visits, thanks to caching.
- Search visibility, since the content is still on the web.
Limits
- Access to hardware and system features is narrower than for native apps, and it varies by platform.
- Some platforms handle installation and notifications differently, or with fewer abilities.
- Heavy graphics or deep operating system integration may still need a native approach.
- Offline logic adds complexity, such as handling out of date data and conflicts.
When a PWA Is a Good Choice
A PWA often fits content sites, tools, dashboards, productivity apps, stores and services where reach and quick updates matter. It is less ideal when you need advanced device features, or when your audience expects to find the app only through an app store.
How to Check Your Work
Developer tools in Chromium based browsers have an Application panel that shows your manifest, service worker status and cache contents. Lighthouse can audit installability and offline behavior. Test with the network switched off to confirm the experience holds up.
Frequently Asked Questions
Do users need an app store to install a PWA?
No. Most modern browsers let people install a PWA directly from the browser, through a prompt or a menu option. Some platforms also allow listing PWAs in stores, but it is not required.
Does a PWA work completely offline?
Only as far as you design it to. The service worker can store pages and files, but live data such as new messages still needs a connection. Many apps show saved content offline and sync changes later.
Is a PWA the same as a regular responsive website?
Not quite. A responsive site adapts its layout to the screen. A PWA adds a manifest, a service worker and secure delivery so it can be installed and work offline. A PWA is normally also responsive.