← CodeClarityLab Home
Browse by Category
+ added · updated 7d
← Back to glossary

Progressive Web Apps (PWA)

mobile ES2015 Intermediate

Also Known As

PWA service worker web app manifest installable web app

TL;DR

Web applications that use service workers, a manifest, and HTTPS to provide app-like experiences — installable, offline-capable, and push notification-enabled.

Explanation

A PWA requires three things: HTTPS (required for service workers), a web app manifest (JSON describing the app for installation), and a service worker (JavaScript that intercepts network requests and manages caching). Capabilities: install to home screen (A2HS), offline functionality, push notifications, background sync, and access to some device APIs. PWAs are progressively enhanced — they work as normal websites for browsers without service worker support. For PHP-rendered apps, PWA techniques add mobile app qualities without a native app.

Diagram

flowchart TD
    subgraph PWA_Requirements
        HTTPS[HTTPS required]
        MANIFEST[Web App Manifest<br/>name icons theme]
        SW[Service Worker<br/>offline caching]
    end
    HTTPS & MANIFEST & SW --> PWA[Progressive Web App]
    PWA --> INSTALL[Install to home screen]
    PWA --> OFFLINE[Works offline]
    PWA --> PUSH[Push notifications]
    subgraph Cache_Strategy
        SW -->|static assets| CACHE_FIRST[Cache first]
        SW -->|API calls| NET_FIRST[Network first<br/>fallback to cache]
    end
style PWA fill:#6e40c9,color:#fff
style INSTALL fill:#238636,color:#fff
style OFFLINE fill:#238636,color:#fff
style CACHE_FIRST fill:#1f6feb,color:#fff
style NET_FIRST fill:#d29922,color:#fff

Common Misconception

PWAs require a JavaScript framework (React, Vue) — any website served over HTTPS can be a PWA; a PHP-rendered site with a manifest and service worker is a valid PWA.

Why It Matters

PWAs provide 60-70% of native app capabilities (offline, push, install) without app store distribution or native development — a significant DX and distribution advantage for web developers.

Common Mistakes

  • Service worker that caches everything including API responses without expiry — stale data shown indefinitely.
  • Not providing a fallback offline page — a blank screen is worse than a 'You are offline' message.
  • Manifest without all required icons — installation prompts fail silently without the required icon sizes.
  • Registering the service worker without scoping it correctly — it may intercept requests it should not.

Code Examples

✗ Vulnerable
// Service worker caches everything forever — stale data:
self.addEventListener('fetch', event => {
    event.respondWith(
        caches.match(event.request).then(cached => {
            return cached || fetch(event.request).then(response => {
                caches.open('v1').then(cache => cache.put(event.request, response.clone()));
                return response;
            });
        })
    );
    // API responses cached indefinitely — user sees week-old data
});
✓ Fixed
// Cache-first for assets, network-first for API:
self.addEventListener('fetch', event => {
    const url = new URL(event.request.url);
    if (url.pathname.startsWith('/api/')) {
        // Network-first for API — fresh data, fallback to cache:
        event.respondWith(fetch(event.request).catch(() => caches.match(event.request)));
    } else {
        // Cache-first for static assets:
        event.respondWith(caches.match(event.request).then(c => c || fetch(event.request)));
    }
});

Added 15 Mar 2026
Edited 22 Mar 2026
Views 47
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings W 0 pings T 0 pings F 3 pings S 0 pings S 1 ping M 0 pings T 0 pings W 0 pings T 0 pings F 3 pings S 1 ping S 1 ping M 0 pings T 0 pings W 0 pings T 0 pings F 4 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 1 ping F 2 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T
No pings yet today
No pings yesterday
Amazonbot 14 ChatGPT 13 Perplexity 9 Google 4 Ahrefs 2 Unknown AI 2
crawler 43 crawler_json 1
DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: High
⚡ Quick Fix
Start with a valid Web App Manifest, register a service worker with a network-first strategy for HTML and cache-first for static assets, then add an install prompt
📦 Applies To
javascript ES2015 web
🔗 Prerequisites
🔍 Detection Hints
No service worker registered; no web app manifest; no offline fallback page; missing HTTPS
Auto-detectable: ✓ Yes lighthouse workbox pwa-builder
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: Medium ✗ Manual fix Fix: High Context: File Tests: Update

✓ schema.org compliant