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

PWA Installation & Add to Homescreen

mobile HTML5 Intermediate

Also Known As

add to homescreen beforeinstallprompt web app manifest PWA install

TL;DR

Progressive Web Apps can be installed to the home screen like native apps — requiring HTTPS, a Web App Manifest, and a Service Worker, plus meeting browser-specific installation criteria.

Explanation

PWA installation criteria (Chrome): HTTPS, registered service worker, valid Web App Manifest (name, icons 192px+512px, start_url, display: standalone). The beforeinstallprompt event fires when the browser decides the app is installable — capture it to show a custom install button rather than relying on the browser's default banner. iOS: does not support the beforeinstallprompt event — you must show manual instructions. Installed PWAs: get their own window, appear in task switcher, have their own icon, and can be launched from home screen without browser UI.

Common Misconception

PWA installation happens automatically once criteria are met — Chrome waits for user engagement before showing the install prompt; you must capture the beforeinstallprompt event and show your own UI at the right moment.

Why It Matters

Installed PWAs have 3x higher engagement than browser sessions — the home screen icon provides the same discoverability and re-engagement as a native app without the App Store friction.

Common Mistakes

  • Not handling iOS separately — Safari does not support beforeinstallprompt; show a manual instruction banner.
  • manifest start_url not served by service worker — breaks offline functionality after installation.
  • Icons not including 512px — required for Chrome install prompt.
  • Showing install prompt too early — capture the event, but show the UI after demonstrating value.

Code Examples

✗ Vulnerable
// Missing manifest fields — not installable:
// manifest.json:
{
    "name": "My App"
    // Missing: icons, start_url, display, theme_color
}
// Result: browser never fires beforeinstallprompt
✓ Fixed
// Complete manifest:
// manifest.json:
{
    "name": "CodeClarityLab Glossary",
    "short_name": "Glossary",
    "start_url": "/glossary/?source=pwa",
    "display": "standalone",
    "theme_color": "#1a1a2e",
    "background_color": "#1a1a2e",
    "icons": [
        {"src": "/icons/192.png", "sizes": "192x192", "type": "image/png"},
        {"src": "/icons/512.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable"}
    ]
}

// Custom install button:
let deferredPrompt;
window.addEventListener('beforeinstallprompt', e => {
    e.preventDefault();
    deferredPrompt = e;
    document.getElementById('install-btn').hidden = false;
});
document.getElementById('install-btn').addEventListener('click', () => {
    deferredPrompt.prompt();
});

Tags


Added 16 Mar 2026
Edited 22 Mar 2026
Views 20
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings W 0 pings T 1 ping F 0 pings S 0 pings S 1 ping M 0 pings T 0 pings W 0 pings T 1 ping F 0 pings S 1 ping S 0 pings M 0 pings T 1 ping W 0 pings T 1 ping F 0 pings S 0 pings S 0 pings M 0 pings T 1 ping W 0 pings T 1 ping F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T
No pings yet today
No pings yesterday
Perplexity 6 Amazonbot 6 Ahrefs 2 Unknown AI 2 Google 2
crawler 17 crawler_json 1
DEV INTEL Tools & Severity
🔵 Info ⚙ Fix effort: Medium
⚡ Quick Fix
Add a web app manifest (manifest.json) with icons, name, and display: standalone — browsers show an 'Add to Home Screen' prompt when your PHP app meets the PWA installability criteria
📦 Applies To
any HTML5 web
🔗 Prerequisites
🔍 Detection Hints
No manifest.json linked in HTML; missing service worker registration; no HTTPS (required for PWA); icons not provided in required sizes
Auto-detectable: ✓ Yes lighthouse chrome-devtools
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: Medium Context: File

✓ schema.org compliant