-
Notifications
You must be signed in to change notification settings - Fork 25
API: JS: User Agent
The mwf.userAgent
object parses out information from nagivator.userAgent
.
In addition, mwf.userAgent
is also responsible for writing body telemetry out to the body as classes. To write out this telemetry, this object leverages not only itself, but also mwf.classification
.
This object is defined in assets/js/core/useragent.js
and is automatically loaded by the JS handler.
The following functions are available through mwf.userAgent
:
-
mwf.userAgent.getOS()
Operating system of the device. -
mwf.userAgent.getOSVersion()
Version number of the device operating system. -
mwf.userAgent.getBrowser()
Browser being used to access the page. -
mwf.userAgent.getBrowserEngine()
Browser engine being used to parse the page. -
mwf.userAgent.getBrowserEngineVersion()
Version number of the browser engine being used to parse the page.
If any of the above information cannot be determined, the functions return false instead.
The following attribute is also available through mwf.userAgent
:
-
mwf.userAgent.cookieName
The name of the cookie that assets/js/core/server.js writes.
Before MWF 1.2, this object was known as mwf.user_agent
, and provided a wider range of functionality including the telemetry that is now provided by the mwf.classification library. For backwards compatibility, this object is still available, though its methods alias those of mwf.userAgent
and mwf.classification
.
-
mwf.user_agent.get_os()
Alias for mwf.userAgent.getOS(). -
mwf.user_agent.()
Alias for mwf.userAgent.getOSVersion(). -
mwf.user_agent.get_browser()
Alias for mwf.userAgent.getBrowser(). -
mwf.user_agent.get_browser_version()
Returns false as MWF 1.2 does not provide this. -
mwf.user_agent.is_mobile()
Alias for mwf.classification.isMobile(). -
mwf.user_agent.is_basic()
Alias for mwf.classification.isBasic(). -
mwf.user_agent.is_standard()
Alias for mwf.classification.isStandard(). -
mwf.user_agent.is_full()
Alias for mwf.classification.isFull(). -
mwf.user_agent.is_touch()
Alias for mwf.classification.isStandard(). -
mwf.user_agent.is_overriden()
Alias for mwf.classification.isOverride(). -
mwf.user_agent.is_preview()
Alias for mwf.classification.isPreview().