A web app manifest is a W3C-specified JSON file that gives a browser the identity and launch settings for an installable website. Link it from every HTML document with `<link rel="manifest" href="app.webmanifest">`. It changes how the site appears in browser and operating-system UI, not the page content. section 3.3.2 section 3.3
Start with the settings that affect an installed app:
- Set `id` to keep updates associated with the same app. Changing it can make the operating system treat the app as a new one, even on the same origin. Use `name` for the app name and, optionally, `short_name` for a compact icon label. section 3.3.2
- Set `start_url` to the launch entry point and `scope` to the URLs that remain inside the installed app. Choose `display` for the preferred launch experience, such as `standalone`. section 3.3.2
- Provide icons, including at least one maskable PNG for adaptive icon shapes. Use `theme_color` as a hint for browser or app chrome and `background_color` for launch screens on supporting platforms. section 3.3.2
Listing 3.1 A simple Web App Manifest for a Progressive Web App
{
"id": "/",
"name": "Coffee Roasters",
"short_name": "Roasters",
"start_url": "/?source=app",
"scope": "/",
"display": "standalone",
"orientation": "any",
"background_color": "#ffffff",
"theme_color": "#996239",
"icons": [
{ "src": "/icons/icon-512.png", "sizes": "512x512",
"type": "image/png", "purpose": "any"},
{ "src": "/icons/icon-512-maskable.png", "sizes": "512x512",
"type": "image/png", "purpose": "maskable"},
{"src": "/icons/icon.svg", "sizes": "all",
"type": "image/svg/+xml"}
]
}
A complete sample manifest combines identity, launch and scope settings, colors, display preferences, and regular and maskable icons. section 3.3.2
A manifest and a secure origin can let the browser offer installation, but behavior varies: Safari can also offer Add to Home Screen without a manifest, using defaults. The manifest does not itself provide offline operation. Pair it with a service worker if the app must boot offline; the two have separate jobs. section 2.4.1 section 15.8
An installable catalog
A catalog can use `/manifest.webmanifest` for its name, icons, screenshots, shortcuts, and launch settings. A separate service worker can cache its app shell so the installed catalog still opens when the network is down. section 15.8
