goog.labs.userAgent.browser
Exported Functions
fullVersionOf( browser ) → (AsyncValue<Version>|undefined)
(AsyncValue<Version>|undefined)
Returns an object that provides access to the full version string of the current browser -- or undefined, based on whether the current browser matches the requested browser brand. Note that the full version string is a high-entropy value, and must be asynchronously loaded before it can be accessed synchronously.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
getVersion() → string
string
Returns the browser version.
Note that for browsers with multiple brands, this function assumes a primary brand and returns the version for that brand.
Additionally, this function is not userAgentData-aware and will return incorrect values when the User Agent string is frozen. The current status of User Agent string freezing is available here: https://www.chromestatus.com/feature/5704553745874944
To mitigate both of these potential issues, use getVersionStringForLogging() or fullVersionOf() instead.
Parameters | None. | ||
---|---|---|---|
Returns |
|
getVersionStringForLogging( browser ) → string
string
Returns a version string for the current browser or undefined, based on whether the current browser is the one specified. This value should ONLY be used for logging/debugging purposes. Do not use it to branch code paths. For comparing versions, use isAtLeast()/isAtMost() or fullVersionOf() instead.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
isAndroidBrowser() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
isAtLeast( brand, majorVersion ) → boolean
boolean
Returns true if the current browser matches the given brand and is at least the given major version. The major version must be a whole number (i.e. decimals should not be used to represent a minor version).
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
isAtMost( brand, majorVersion ) → boolean
boolean
Returns true if the current browser matches the given brand and is at most the given version. The major version must be a whole number (i.e. decimals should not be used to represent a minor version).
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
isChrome() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
isCoast() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
isEdge() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
isEdgeChromium() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
isFirefox() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
isIE() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
isIosWebview() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
isOpera() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
isOperaChromium() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
isSafari() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
isSilk() → boolean
boolean
For more information, see: http://docs.aws.amazon.com/silk/latest/developerguide/user-agent.html
Parameters | None. | ||
---|---|---|---|
Returns |
|
isVersionOrHigher( version ) → boolean
boolean
Returns whether the current browser's version is at least as high as the given one.
Note that for browsers with multiple brands, this function assumes a primary brand and checks the version for that brand.
Additionally, this function is not userAgentData-aware and will return incorrect values when the User Agent string is frozen. The current status of User Agent string freezing is available here: https://www.chromestatus.com/feature/5704553745874944
To mitigate both of these potential issues, use isAtLeast()/isAtMost() or fullVersionOf() instead.
warning Deprecated | Use isAtLeast()/isAtMost() instead. |
---|
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
loadFullVersions() → Promise<undefined>
Promise<undefined>
Requests all full browser versions to be cached. When the returned promise
resolves, subsequent calls to fullVersionOf(...).getIfLoaded()
will return
a value.
This method should be avoided in favor of directly awaiting
fullVersionOf(...).load()
where it is used.
Parameters | None. | |
---|---|---|
Returns |
|
resetForTesting() → void
void
Resets module-local caches used by functionality in this module. This is only for use by goog.labs.userAgent.testUtil.resetUserAgent (and labs.userAgent tests).