getUserAgent (XSPContext - JavaScript™)
Gets the User-Agent request header field of the HTTP request sent from the browser.
Defined in
XSPContext (JavaScript)Syntax
getUserAgent() : XSPUserAgent (JavaScript)
Return value | Description |
---|---|
XSPUserAgent |
A representation of the User-Agent request header field. |
Examples
This computed field displays the browser and version, or the complete user agent string if the browser is not identified:var browser = context.getUserAgent().getBrowser();
if(!browser.isEmpty()) {
return browser + " " + context.getUserAgent().getBrowserVersion();
} else {
return context.getUserAgent().getUserAgent();
}