Last active
February 4, 2025 08:08
-
-
Save IvoPereira/5a5106cdf9819af385fad55925f96190 to your computer and use it in GitHub Desktop.
Detect if a PWA is installed (iOS Standalone, Trusted Web App, Chrome PWA)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isPWA() { | |
return window.navigator.standalone == true || // iOS PWA Standalone | |
document.referrer.includes('android-app://') || // Android Trusted Web App | |
["fullscreen", "standalone", "minimal-ui"].some( | |
(displayMode) => window.matchMedia('(display-mode: ' + displayMode + ')').matches | |
) // Chrome PWA (supporting fullscreen, standalone, minimal-ui) | |
} | |
console.log(isPWA()) // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi
i have use your code. but its not working and in all cases return false