getVersion (XSPUserAgent - JavaScript)

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

Syntax

getVersion(entry:string) : string
Parameter Description
string The name of an entry in the user agent.
Return value Description
string The version for the entry, or an empty string 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

To get the version as a number see getVersionNumber (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")
	}
}