How to Turn a Website into an Installable PWA with Offline Support
Make a site installable and offline-ready: manifest fields, maskable icons, service worker caching strategies, offline page, updates and installs.

How to Turn a Website into an Installable PWA with Offline Support
A Progressive Web App is a website that can be installed like an app, opens in its own window and keeps working on a bad connection. You do not need a framework: a manifest file, a service worker script and a few lines in your HTML are enough. This guide explains each piece and the decisions behind it, using the free PWA manifest and service worker generator.
The manifest describes the app
The web app manifest is a JSON file linked from every page. It gives the app's name and short name, the start URL, the scope of pages that belong to the app, the display mode, colours and icons. Display standalone removes the browser address bar, which is what most apps want. The start URL must sit inside the scope. Setting an id keeps the installed app's identity stable if you change the start URL later. Shortcuts add entries to the long-press menu on Android and the context menu on desktop, and screenshots enable a richer install dialog.
Icons that survive masking
Android shapes icons into circles, squircles or rounded squares. An icon with purpose maskable has its important content inside a central circle covering 80 % of the image, so no shape cuts it off. Provide maskable icons at 192 and 512 pixels besides the normal set. The generator draws both from your logo and shows circle and squircle previews.
The service worker decides what is cached
A service worker sits between the page and the network. It precaches a list of essential files at install and handles every request afterwards. The heart of a good worker is choosing a strategy per kind of request:
- Cache first for files that never change under the same URL, such as fingerprinted scripts, images and fonts. It is fastest and works offline.
- Network first for HTML pages and API calls whose freshness matters. Online users get current data; offline users get the last cached copy. A timeout stops slow networks from blocking the page.
- Stale while revalidate for files that change occasionally, such as unversioned CSS. The cached copy is served immediately and updated in the background.
- Network only for requests that must never be cached, such as payments.
Limit caches with a maximum number of entries and a maximum age, or they grow without bound.
Offline page and updates
When a page is neither online nor cached, show a friendly offline page instead of the browser's error. Updates need a plan. Each deployment should change the cache version so the new worker deletes old caches when it activates. A new worker normally waits until all tabs of the old version are closed; either activate it immediately or, better for apps with unsaved state, show a prompt asking the user to reload.
Installation
Chromium browsers offer installation when the site is served over HTTPS, has a manifest with name, icons and a suitable display mode, and registers a service worker. You can show your own install button by listening for the beforeinstallprompt event. iOS Safari has no such event; users install through Share and Add to Home Screen, so a short hint helps.
Check it in DevTools
Chrome DevTools has an Application panel with Manifest and Service workers sections. They show parsing errors, icons, the active worker and cache contents, and let you simulate offline mode. Test both a first visit and a returning visit.
Limits
The generated worker covers common caching needs; push notifications, background sync and complex routing need additional code or a library such as Workbox. Caching rules that suit one site can be wrong for another, especially for personalised pages, so review what you cache. Browser support for some manifest fields differs between Chromium, Firefox and Safari.



