getVersionNumber (XSPUserAgent - JavaScript)

Gets the version for a user agent entry as a number.

Syntax

getVersion(entry:string) : double
Parameter Description
string The name of an entry in the user agent.
Return value Description
double The version for the entry, or 0.0 if there is no associated version.

Usage

The format of an entry in the user agent header field is entryname/version if the entry has a version. For example, the version of the Mozilla entry in the following field is 5.0:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1

A version number is carried only to one decimal position.

To get the version as a string see getVersion (XSPUserAgent - JavaScript).

Examples

This computed field displays a message depending on the version of the Mozilla entry:
if(context.getUserAgent().hasEntry("Mozilla")) {
	if(context.getUserAgent().getVersionNumber("Mozilla") < 5.0) {
		"Mozilla version must be at least 5.0. Current version is " +
		context.getUserAgent().getVersion("Mozilla")
	}
}