liveBook · Manning

Web app manifest

As explained in Vanilla Web

A Web App Manifest is a JSON document that supplies metadata describing a web application, such as its name, icons, colors, and launch URL.

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

How Vanilla Web covers it

How deep it goes
Defines the JSON file and HTML link, then explains core fields and shows an expanded app configuration; defers further settings.
Examples
Shows a linked sample JSON manifest and a catalog app whose installation metadata includes screenshots and shortcuts.
What it assumes
Assumes access to HTML documents and a JSON file, while requiring no framework or compilation.
What you can do after
Operate/configure it by linking a manifest and choosing app identity, launch behavior, colors, and icons for installation.
How it connects
Connects web metadata and Progressive Web Apps with installability, icons, secure origins, and service workers for a separate offline capability.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Vanilla Web. The section links point to the parts of the book it draws on.