demo · v140
Desktop PWA promo gate
Chrome 140 extends navigator.getInstalledRelatedApps() to desktop PWA detection. Use it to suppress install promos for users who already installed your PWA. Pick a scenario and watch the promo logic flip.
User state:
getInstalledRelatedApps() returns
[]
| scenario | desktop promo | mobile promo |
|---|---|---|
| nothing installed | show | show on mobile UAs |
| iOS app installed | show | hide |
| Android app installed | show | hide |
| desktop PWA installed | hide | show on mobile UAs |
// declare related apps in the page
<link rel="manifest" href="/manifest.webmanifest">
// manifest.webmanifest
{
"related_applications": [
{ "platform": "play", "id": "com.acme.app" },
{ "platform": "itunes", "url": "https://itunes.apple.com/app/id1234" },
{ "platform": "webapp", "url": "https://acme.example/manifest.webmanifest" }
],
"prefer_related_applications": true
}
// query at runtime
const installed = await navigator.getInstalledRelatedApps();
const hasDesktopPwa = installed.some(a => a.platform === "webapp");
if (!hasDesktopPwa) showDesktopInstallPromo();