OSVersion Property (.NET)

 

Type: String

 

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.2". Note that Windows also has version numbers which represent the OS type, such as XP, Vista or Windows 8.

 

Tip: See Detecting Operating System Details for examples of the possible values returned by this property.

 

This is the basic property version of OSVersion. Starting with BrowserHawk 14, the OSVersion property can be checked as a basic property, so an extended property test is no longer required. If you previously used this property as an extended property, simply remove the "OSVersion" from the list of properties specified in your call to AddProperties and use this OSVersion property from the BrowserObj class instead of from the ExtendedBrowserObj class.  There are two cases, however, where using the extended property version of OSVersion 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.2", and 2) With Opera version 10 and earlier on OS X, no OSVersion information is available with the basic property version.  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: 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.

 

C# Example:

<html>OS version:

<% BrowserObj browObj = BrowserObj.GetBrowser();

Response.Write(browObj.OSVersion);

%>

</html>

 

See Also:

Detecting Operating System Details

OSName Property (.NET)

OSDetails Property (.NET)