I'm using the following to detect if the app is running from the installed PWA or the browser version:
if (window.matchMedia('(display-mode: standalone)').matches) {
alert('app is installed');
} else alert('app is not installed');
It works fine if I installed the app from Chrome and run it from the home screen, but returns false if I have installed the app via the Firefox menu's "Install" option and run it from the home screen.
Interestingly, when I add
"start_url": "/?mode=standalone",
to my manifest file and check for it's existence in my js it successfully returns true for the FF Homescreen run app and false for the browser, so I am able to use that as a check for installation in browsers where 'beforeinstallprompt' is not available.
Is this correct? If so, how do we detect if the app is running from a Firefox installed homescreen icon, please?