I have written a Firefox extension and am currently in the process of updating it for Firefox 4 and adding some new features.
Firefox 4 has a great new notification display that I'd quite like to use and have found plenty of documentation on how to use it. However, for anything less than 4 I have created my own notification window with specific styles.
My question is: how can I detect whether I'm using Firefox 4 or not in the javascript for my extension. Or, is there a better way of doing this?
On the menu bar, click the Firefox menu and select About Firefox. The About Firefox window will appear. The version number is listed underneath the Firefox name.
Extension Metadata menu that appears when you right-click on the extension button. It also adds a context menu item on Firefox and Chrome extension links. The "View source" option opens a new tab with a simple viewer, with the following features: - Download-as-zip and download-as-crx at the upper-right corner.
Extensions are like apps for Firefox. They add features to Firefox to make browsing faster, safer, or just plain fun. See all extensions. Elite ad blockers.
Extensions for Firefox are built using the WebExtensions API cross-browser technology. The technology for extensions in Firefox is, to a large extent, compatible with the extension API supported by Chromium-based browsers (such as Google Chrome, Microsoft Edge, Opera, Vivaldi).
You can use nsIXULAppInfo
:
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULAppInfo);
// appInfo.version contains the version
You can compare versions with nsIVersionComparator
.
Maybe there is a better way, but this definitely works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With