On Thunderbird version 3.0b3pre and later, you can use the following snippet to get the Thunderbird version. (Version 3.0b3pre was the first build to include STEEL.)

var versionChecker = 
Components.classes["@mozilla.org/xpcom/version-comparator;1"].getService(Components.interfaces.nsIVersionComparator);

if (versionChecker.compare(Application.version, "3.0b4") >= 0)
  // code for >= 3.0b4
else
  // code for <  3.0b4

For versions prior to 3.0b3pre, you can use something like this:

var version;
if ( "@mozilla.org/xre/app-info;1" in Components.classes )
  version = Components.classes["@mozilla.org/xre/app-info;
1"].getService(Components.interfaces.nsIXULAppInfo).version;
else
  version = Components.classes["@mozilla.org/preferences-service;
1"].getService(Components.interfaces.nsIPrefBranch).getCharPref
("app.version");

var versionChecker = Components.classes["@mozilla.org/xpcom/version-
comparator;1"].getService(Components.interfaces.nsIVersionComparator);

if ( versionChecker.compare( version, "3.0b3" ) >= 0 )
  // code for >= 3.0b3
else
  // code for < 3.0b3

Document Tags and Contributors

Tags: 
 Contributors to this page: wbamberg, Philip Chee, jenzed
 Last updated by: wbamberg,