Checks if the user agent header field contains an entry.
Parameters |
Description |
string |
The name of the entry. |
Return value |
Description |
boolean |
true if the header field contains
the entry; false otherwise. |
Usage
The format of an entry in the user agent header field is
entryname/version
. For example, the following header has entries
for Mozilla
, Gecko
, and
Firefox
:Mozilla/5.0 (Windows; U; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
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")
}
}