HerokuChristine DodrillTutorial
PWA Tutorial: Turn Your Website Into a Progressive Web App
Summary
Progressive web apps let websites provide app-like experiences, including home-screen installation, offline access, push notifications, and some device hardware APIs, without separate platform-specific code or app-store approval. This tutorial converts an existing site by adding a JSON manifest, linking it from the base HTML, creating an offline page, implementing a service worker, registering that worker, and deploying over HTTPS. The service worker precaches important routes during installation and handles fetches by serving network responses, caching them, or falling back to cached content and offline.html; the example uses the "offline" cache and includes routes such as /blog/, /contact, and /resume. It also covers installation through Safari and Chrome and notes that iOS does not support background sync.
Context
The tutorial addresses converting an existing website into a progressive web app so it can offer app-like functionality, including offline access and device features, while using a single codebase and avoiding app-store approval processes.
Approach / What changed
Add a web app manifest and link it from the base HTML, create offline.html, implement and register a service worker that precaches selected routes and caches fetched resources, then deploy the site over HTTPS. The tutorial also describes adding the resulting app through Safari and Chrome.
Takeaways
The manifest defines installation metadata such as the app name, colors, scope, start URL, description, orientation, and home-screen icons.
The example service worker precaches /blog/, /blog, /, /contact, /resume, and /offline.html, then falls back to cached content or offline.html when a fetch cannot be satisfied.
The service worker file must be served from the same level as the manifest scope, and the site must be served over HTTPS for installation.
Source and freshness
- Source
- heroku.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.