Progressive Web Apps combine the reach of the web with app-like experiences. Three core requirements: HTTPS, a Web App Manifest, and a Service Worker.
Web App Manifest: JSON file defining the app's name, icons, theme color, and start URL. Symfony serves it as a JSON response from a controller. Add <link rel="manifest"> to the base template.
Service Worker: Background script that intercepts network requests. Common caching strategies:
- Cache-First: Serve from cache, fall back to network (ideal for static assets)
- Network-First: Try network, fall back to cache (ideal for API endpoints)
- Stale-While-Revalidate: Serve cached version immediately, update cache in background (ideal for blog posts)
Offline page: The Service Worker can serve a custom /offline.html when both cache and network are unavailable.
GDPR: Service Workers are inherently GDPR-friendly — they cache data already transmitted. Push notifications require explicit browser opt-in (the browser dialog counts as GDPR consent). Mention Service Worker usage in your privacy policy.
PWA audit: Note that the PWA category was removed from Lighthouse v12.0 (May 2024). PWA checks are no longer scored as a separate Lighthouse category. Use Chrome DevTools (Application tab) or tools like pwabuilder.com to verify PWA requirements. Aim for proper icon sizes (192x192, 512x512), a valid manifest, and confirmed Service Worker registration.
Kommentare
Kommentare werden von Remark42 bereitgestellt. Beim Laden werden Daten an unseren Kommentar-Server übertragen.