xpcom/system/nsIXULAppInfo.idlScriptable
This interface provides information about the host application. It can be used to distinguish between different Mozilla-based applications. It provides application name, application version, Gecko version and more.
1.0
66
Introduced
Gecko 1.8
Inherits from: nsISupports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

In XULRunner applications nsIXULAppInfo obtains app-specific information from application.ini.

Implemented by: @mozilla.org/xre/app-info;1. To create an instance, use:

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

The nsIXULRuntime interface is also implemented by "xre/app-info". It contains advanced information on the xul runtime.

Attributes

Attribute Type Description
appBuildID ACString The application's build ID/date, for example "2004051604". For XULRunner applications, this will be different than the build ID of the platform. Be careful about which one you want. Read only.
ID ACString

The XUL application's UUID. Can be an empty string, if id is not set. Has to be defined for advanced application features such as the extension manager and update service.

This has traditionally been in the form "{AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE}" but for new applications a more readable form is encouraged: "appname@vendor.tld". Only the following characters are allowed: a-z A-Z 0-9 - . @ _ { } * Read only.
name ACString The name of the application. This must be ASCII, and is normally mixed-case, for example "Firefox", "Thunderbird" or "SeaMonkey". Must not be null or an empty string. Read only.
platformBuildID ACString The build ID/date of Gecko and the XULRunner platform. Read only.
platformVersion ACString The version of Gecko or XULRunner platform, for example "1.8.1.19" or "1.9.3pre". In "Firefox 3.7 alpha 1" the application version is "3.7a1pre" while the platform version is "1.9.3pre" Read only.
vendor ACString The name of the application vendor. This must be ASCII, and is normally mixed-case, for example "Mozilla". Can be an empty string if vendor is not set. Read only.
version ACString The XUL application's version, for example "0.8.0+" or "3.7a1pre". It is different than the version of Gecko or the XULRunner platform. Be careful about which one you want! Can be an empty string, but a valid value is required for XUL applications using the extension manager or update service. Read only.

Example

Display the application and the gecko version in an alert box:

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

alert("Application Version: " + info.version + "\n"
   + "Gecko Version: " + info.platformVersion);

Example

This example here uses nsIXULAppInfo to get the version of the current browser and then compares it: Example - Compare current browser version

See also