Get browser version from Firefox Extension

I wrote the Firefox extension and am currently updating it for Firefox 4 and adding some new features.

Firefox 4 has a great new notification display that I would really like to use, and found a lot of documentation on how to use it. However, for anything less than 4, I created my own notification window with special styles.

My question is: how can I determine if I use Firefox 4 or not in javascript for my extension. Or is there a better way to do this?

+5
source share
2 answers

You can use nsIXULAppInfo:

var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
                    .getService(Components.interfaces.nsIXULAppInfo);
// appInfo.version contains the version

nsIVersionComparator.

, , .

+10

All Articles