这两种方法都没有用于检测standalone
Chrome Android 中的模式在我的 PWA 中工作 https://licitaciones.chilediseno.org
这是我尝试过的CSS方法
@media all and (display-mode: standalone) {
/* Here goes the CSS rules that will only apply if app is running standalone */
}
这是 Javascript 方法(第 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 */
}
它们都不起作用:测试isRunningStandalone()
在 Chrome Android 中远程返回false
,即使该示例有效。
(示例由@josemmo制作here https://stackoverflow.com/a/34516083/345605)
我已经在 iOS 和 3 部不同的 Android 手机中测试了代码。 iOS 运行完美。
我找到了问题的解决方案:manifest.json
必须有"display": "standalone"
"display": "fullscreen"
不管用。我也无法测试它。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)