demo · v148

Install Button Cookbook

Three common recipes for the declarative install element. Each card shows the markup, a rendered preview of what the button looks like, and what the click does. The rendered buttons are mocks of the UA-provided install affordance.

Same-origin install

Install
<install>Install</install>

Triggers install for the current origin's manifest. No JS required.

Cross-origin install

Get the AnotherSite app
<install
  manifest="https://app.example.com/manifest.json"
  start-url="https://app.example.com/">
  Get the AnotherSite app
</install>

Lets a marketplace host the install entry point. Requires the target origin to opt-in.

With custom icon

PK Install Paul's Pubs
<install>
  <img slot="icon" src="/pk.svg" alt="">
  Install Paul's Pubs
</install>

Style the affordance with a slot for an icon. The UA still owns the install prompt itself.

see also

scenario focus

Select a scenario to focus its rendered example and summary.

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗