Reputation: 691
Neither one of the methods used to detect standalone
mode in Chrome Android work in my PWA
This is the CSS method I tried
@media all and (display-mode: standalone) {
/* Here goes the CSS rules that will only apply if app is running standalone */
}
And this is the Javascript method (line 171-175, 297-306)
function isRunningStandalone() {
return (window.matchMedia('(display-mode: standalone)').matches);
}
...
if (isRunningStandalone()) {
/* This code will be executed if app is running standalone */
}
Neither one of them worked: Testing isRunningStandalone()
remotely in Chrome Android returns false
, even though the example works.
(example made by @josemmo here)
I have tested the code in iOS and 3 different Android Phones. iOS works perfectly.
Upvotes: 5
Views: 3034
Reputation: 691
I found the solution to the problem: manifest.json
has to have "display": "standalone"
"display": "fullscreen"
will not work. I could not test for it either.
Upvotes: 7