Implementation:SeleniumHQ Selenium Closure UserAgent
| Knowledge Sources | |
|---|---|
| Domains | JavaScript_Atoms, Vendored_Library |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Vendored Google Closure Library module providing rendering engine and browser detection via user agent string parsing.
Description
Rendering engine detection utilities. Exposes compile-time constants and runtime checks for browser engines (IE, Edge/EdgeHTML, Gecko, WebKit, Opera/Presto) and platforms (mobile). Supports compile-time assumptions (ASSUME_IE, ASSUME_GECKO, etc.) for dead-code elimination by the Closure Compiler. For browser brand detection (Safari vs Chrome), see goog.userAgent.product.
Usage
Consumed internally by Selenium's JavaScript atoms build system.
Code Reference
Source Location
- Repository: SeleniumHQ_Selenium
- File: third_party/closure/goog/useragent/useragent.js
Key Exports
goog.provide('goog.userAgent');
// Compile-time assumption flags
goog.userAgent.ASSUME_IE
goog.userAgent.ASSUME_EDGE
goog.userAgent.ASSUME_GECKO
goog.userAgent.ASSUME_WEBKIT
goog.userAgent.ASSUME_MOBILE_WEBKIT
goog.userAgent.ASSUME_OPERA
// Runtime detection constants
goog.userAgent.OPERA // Presto-based Opera
goog.userAgent.IE // Internet Explorer
goog.userAgent.EDGE // EdgeHTML-based Edge
goog.userAgent.EDGE_OR_IE
goog.userAgent.GECKO // Firefox/Gecko engine
goog.userAgent.WEBKIT // WebKit engine
goog.userAgent.MOBILE // Mobile browser
goog.userAgent.SAFARI // Alias for WEBKIT
// Functions
goog.userAgent.getUserAgentString = function() { ... };
goog.userAgent.getNavigator = function() { ... };