According to this article, display-mode: standalone
only can detect on M48 or newer version. Is there any way to detect the mode on older version?
Although it's not a direct answer but it's offering a workaround.
As much as I understand the article, you can configure your website (in the manifest.json) to open with querystring (for example) if it opens from the homescreen. So you can set a flag on the DOM - let's say add class to the body
tag. In this way you can detect in eitgher css or js if you run in standalone mode.
For example:
var isStandalone = false;
if (location.search.indexOf('standalone=true') > -1) {
isStandalone = true;
document.body.classList.add('standalone-mode');
}
// from now on you can check if you run in standalone by checking 'isStandalone' param.
header {
background: red;
}
/* this is a style for standalone mode only */
body.standalone header {
background: green
}
No this is not possible. Check this article
@supports for display-mode is only supported starting with Chrome 48.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With