2

I am making an addon for both firefox and fennec and I want to know if it is running on fennec or not.

tmim
  • 12,091
  • 4
  • 18
  • 12

4 Answers4

1

The global Application object (provided by FUEL) will give you various properties such as name or id that you can use to determine this.

sdwilsh
  • 4,674
  • 1
  • 22
  • 20
1

What sdwilsh said or using nsIXULAppInfo.

If Fennec does support FUEL (I haven't checked), it's a matter of personal preference which one to use. FUEL is supposed to be a simpler-to-use wrapper around the nsI* components.

Nickolay
  • 31,095
  • 13
  • 107
  • 185
0

In the current version of the extensions API, the xul-app module exposes a name property which is set to either Firefox or Fennec. This seems to work nicely.

var xul_app = require('xul-app');
var isMobile = (xul_app.name.toLowerCase().indexOf('fennec') > -1);
jimrandomh
  • 895
  • 8
  • 15
0

You could use document.getElementById("browsers"). In firefox, it's null but in fennec it returns a HTMLDivElement object

tmim
  • 12,091
  • 4
  • 18
  • 12
  • 1
    It's null now, but that could easily change in the future. It's better to use a more stable API. – sdwilsh Feb 17 '10 at 05:49