Re: [w3c/manifest] Way to detect if a web app is installed (Issue #1092)

benfrancis left a comment (w3c/manifest#1092)

@dmurph wrote:
> From most of the requests for this feature, the problem was based around the fact that the `fullscreen` display mode made it confusing to detect if the... wrapping chrome?... was a pwa standalone experience or a browser tab. This is attempting to solve that.

If this is the primary use case, can you explain it in a bit more detail?

If a browsing context has the `fullscreen` display mode applied then it can *only* be an installed application. This is different to a Document or Element being displayed full screen from any browsing context using the fullscreen API, which should be detected separately using `document.fullscreenElement`.

> This highlights a problem with the name standalone.... and installed....

I agree.

### standalone

For better or worse the term "standalone" has always been used in the Manifest specification to refer to a specific display mode. Re-using that term to mean "the app is installed and using the minimal-ui, standalone or fullscreen display mode but not the browser display mode" is potentially very confusing.

This is why I think having something like `window.displayMode` with an enum value (`browser`, `minimal-ui`, `standalone`, `fullscreen`) or a `display-mode` media query would make more sense.

### installed

Whether or not an application is "installed" is a bit more loosely defined, but is a separate state to the display mode. An application can be installed and not standalone but it can't be standalone and not installed.

Having the "installed" media query return no when an app is installed but using the browser display mode also seems confusing to me.

Also, if an app is installed on the OS with the standalone display mode but then the user loads a page from within its navigation scope in a browser tab, will the "installed" media query return yes or no?

> If we also want to detect if the pwa is installed with os integration, that is possible today on Android (and hopefully soon on desktop) on chromium with the [getInstalledRelatedApps()](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getInstalledRelatedApps) API, where the page can request if it's own app id is installed.

As I understand it this method is currently Chromium-specific, and is also confusingly named for this particular use case.

FWIW at one point Gecko also had a proprietary methods called `window.navigator.mozApps.getSelf()` and `window.navigator.mozApps.checkInstalled(manifestUrl)`.

Of course on some operating systems there's also the added complication that a web app may be installed but from a different browser...

---

Maybe there should be a `display-mode` media query to test the display mode the _current_ browsing context is in, and a method like `navigator.isInstalled()` or `document.isInstalled()` to test whether the currently loaded document falls within the navigation scope of an installed web application (regardless of display mode).

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/1092#issuecomment-2883502044
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/manifest/issues/1092/2883502044@github.com>

Received on Thursday, 15 May 2025 11:35:32 UTC