Last Updated: December 26, 2018
·
2.281K
· basiclines

How to detect Firefox web apps support in mobile

var isFFOS = (!!"mozApps" in navigator && navigator.userAgent.search("Mobile") != -1);

4 Responses
Add your response

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.

over 1 year ago ·

Thx @mare for the tip, but this is actually the real intention, as you can install FFOS applications from Firefox for Android

over 1 year ago ·

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).

over 1 year ago ·

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 !!

over 1 year ago ·