PWA running fullscreen in Chrome Android does not honor Display-mode: standalone

删除回忆录丶 提交于 2019-12-11 03:31:45

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/54640893/pwa-running-fullscreen-in-chrome-android-does-not-honor-display-mode-standalone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!