nsIXULRuntime
From MDC
The nsIXULRuntime interface provides a means for extensions and XUL applications to determine information about the XUL runtime.
Contents |
nsIXULRuntime is defined in toolkit/xre/nsIXULRuntime.idl. It is scriptable and
unfrozen (hasn't changed since Mozilla 1.8).
Status: UNSTABLE - This interface is not frozen and will probably change in future releases. If you need this functionality to be stable/frozen, please contact Benjamin Smedberg.
Inherits from: nsISupports
Implemented by: @mozilla.org/xre/app-info;1. To get an instance, use:
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
[edit] Attributes
| Attribute | Type | Description |
inSafeMode
| readonly PRBool
| Whether the application was launched in safe mode. |
logConsoleErrors
| PRBool
| Whether to write console errors to a log file. If a component encounters startup errors that might prevent the app from showing proper UI, it should set this flag to "true". |
OS
| readonly AUTF8String
| A string tag identifying the current operating system. This is taken from the OS_TARGET configure variable. It will always be available. Returns "WINNT" on Windows XP, 2000, NT and returns "Linux" on GNU/Linux. |
XPCOMABI
| readonly AUTF8String
| A string tag identifying the binary ABI of the current processor and compiler vtable. This is taken from the TARGET_XPCOM_ABI configure variable. It may not be available on all platforms, especially unusual processor or compiler combinations.
The result takes the form -, for example: x86-msvc ppc-gcc3 This value should almost always be used in combination with "OS". May throw |
[edit] Example
Display the user's operating system in an alert box:
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
alert(xulRuntime.OS);