How to detect Firefox web apps support in mobile
var isFFOS = (!!"mozApps" in navigator && navigator.userAgent.search("Mobile") != -1);
Written by Ismael González
Related protips
4 Responses
If you try it on a Mozilla Firefox navigator on an Android phone It returns true.
I also add (navigator.userAgent.search("Android")<0) into the condition to solve it.
Thx @mare for the tip, but this is actually the real intention, as you can install FFOS applications from Firefox for Android
I'm really sorry but when I read the post title I understood that you are detecting a FirefoxOS system from among all systems, because behavior is not always the same.
Well, If someone else had my same confusion and really want to discriminate between a FirefoxOS system and anything else, I want to recommend changing my previous condition with this one. (!!navigator.mozId).
I've changed the title of the protip, as what i really want to show here is how to detect if a device is capable of accepting a firefox application package, which could be Android and FirefoxOS devices.
Thx anyway @marti1125 !!