BrowserHawk provides three properties useful in determining the user's operating system name and version. These properties are OSName, OSVersion and OSDetails.
OSName returns the general name of the user's operating system, such as "Windows", "OS X", and "Linux". For example, the OSName property is set to "Windows" for all users on Windows 98, Windows XP, Windows Vista, Windows 8 and other Windows based operating systems, and OSName is set to "OS X" for all Mac users on OS X. Therefore this property makes it easy to determine if a user is on Windows, OS X, Linux and other operating systems without regards to what version of the OS is in use.
OSVersion returns the version number, as a string, of the user's operating system. Examples of the OSVersion string for OS X users include "10.6.8" and "10.7.1". Note that Windows also has version numbers which represent the OS type, such as XP, Vista or Windows 8.
The following table lists the OSVersion numbers returned for common Windows and OS X operating systems:
Windows OS | Version returned in OSVersion property |
Windows 95 | 4.0 |
Windows NT | 4.0 |
Windows 98 | 4.1 |
Windows ME | 4.9 |
Windows 2000 | 5.0 |
Windows XP | 5.1 |
Windows Server 2003 | 5.2 |
Windows Vista | 6.0 |
Windows Server 2008 | 6.0 |
Windows 7 | 6.1 |
Windows Server 2012 | 6.2 |
Windows 8 | 6.2 |
Windows Server 2012 R2 | 6.3 |
Windows 8.1 | 6.3 |
OS X (Mac) | Version returned in OSVersion property |
OS X Cheetah | 10.0.x |
OS X Puma | 10.1.x |
OS X Jaguar | 10.2.x |
OS X Panther | 10.3.x |
OS X Tiger | 10.4.x |
OS X Leopard | 10.5.x |
OS X Snow Leopard | 10.6.x |
OS X Lion | 10.7.x |
OS X Mountain Lion | 10.8.x |
OS X Mavericks | 10.9.x |
Note that the OSVersion property is returned as a string. For numeric comparisons, such as checking to see if a version is greater than a certain version, you may find BrowserHawk's CompareVersion helper function useful.
OSDetails returns the user-friendly name of the operating system, based on the OS type and version. In the case of Windows, it returns values such as "Windows 98", "Windows XP", "Windows 2000", "Windows Vista", "Windows 7", and "Windows 8", and "Windows 8.1". In the case of OS X it returns values such as "OS X Tiger", "OS X Snow Leopard", and "OS X Mavericks". In the case of other operating systems it returns the name of the OS, followed by the version number, if available.
The following table lists of the OSDetails property value returned for common Windows and OS X operating systems:
Windows OS | Value returned in OSDetails |
Windows 95 | Windows 95 |
Windows NT | Windows NT |
Windows 98 | Windows 98 |
Windows ME | Windows ME |
Windows 2000 | Windows 2000 |
Windows XP | Windows XP |
Windows Server 2003 | Windows Server 2003 |
Windows Vista | Windows Vista |
Windows Server 2008 | Windows Server 2008 |
Windows 7 | Windows 7 |
Windows 8 | Windows 8 |
Windows 8.1 | Windows 8.1 |
OS X | Value returned in OSDetails |
OS X 10.0 (Cheetah) | OS X Cheetah |
OS X 10.1 (Puma) | OS X Puma |
OS X 10.2 (Jaguar) | OS X Jaguar |
OS X 10.3 (Panther) | OS X Panther |
OS X 10.4 (Tiger) | OS X Tiger |
OS X 10.5 (Leopard) | OS X Leopard |
OS X 10.6 (Snow Leopard) | OS X Snow Leopard |
OS X 10.7 (Lion) | OS X Lion |
OS X 10.8 | OS X Mountain Lion |
OS X 10.9 | OS X Mavericks |
The OSName, OSVersion and OSDetails properties are available as both basic and extended properties. BrowserHawk for .NET and Java users will therefore find these properties both under the BrowserObj class and the ExtendedBrowserObj class.
In general, we recommend only obtaining these properties using the basic versions (not performing an extended property test). The basic property check is instantaneous, whereas the extended property check requires BrowserHawk to use Java to perform this test, which is much slower in comparison. There are two cases, however, where using the extended property version of these properties has an advantage when it comes to testing OS X users: 1) With Firefox on OS X the basic version of OSVersion will only return the version in x.y format, such as "10.7" and not "10.7.1", and 2) With Opera version 10 and earlier on OS X, no OSVersion information is available. If these cases are very important to you, use the extended property version. Otherwise the basic version will provide the same results, but much faster.
Note that prior to BrowserHawk14, OSName and OSVersion were only available as extended properties. Therefore, if you were checking these properties prior to BrowserHawk 14 and you want to switch to the basic version of these properties, you will need to slightly modify your code. To do so - for ActiveX users of BrowserHawk, do not specify "OSName", "OSVersion" or "OSDetails" in the call to SetExtProperties. For .NET and BH4J users, do not specify those names in the call to AddProperties, and get these values from the BrowserObj instance instead of the ExtendedBrowserObj instance.
See Also:
OSName Property (ActiveX) / (.NET basic) / (.NET extended)
OSVersion Property (ActiveX) / (.NET basic) / (.NET extended)
OSDetails Property (ActiveX) / (.NET basic) / (.NET extended)