Definition
Standalone mode detection
Standalone mode detection means checking, at runtime, whether the current page is running as an installed app rather than a regular tab. On Chromium and most browsers this is window.matchMedia("(display-mode: standalone)").matches; on iOS Safari the historical equivalent is the non-standard navigator.standalone boolean, since iOS predates the display-mode media feature's adoption there.
A combined cross-platform check commonly looks like: const isInstalled = window.matchMedia("(display-mode: standalone)").matches || window.navigator.standalone === true;, covering both the standards-based and the iOS-specific signal.
This detection is typically used to hide "Install this app" prompts once the user is already inside the installed experience, and sometimes to adjust UI — for example, hiding a redundant browser-style back button that would duplicate OS-level back gestures.
The display-mode media query also matches fullscreen and minimal-ui, not just standalone, so a query like "(display-mode: browser)" — which is true precisely when none of the app-like modes apply — is the more reliable way to detect "definitely NOT installed" if that is what the logic actually needs.
Detection can only run after the page has loaded in its actual context; there is no reliable way to know in advance, before installation, whether a *future* launch will be standalone, which is why this check is purely a post-hoc runtime signal, not a predictive one.