From MozillaWiki
Jump to: navigation, search

User Agent (UA) Detection Use Cases

User Agent Detection creates a lot of secondary issues often unseen by the Web developers putting them into places. The goal for Web developer is to tackle a real issue they have for their own Web property, but at the same time often create a range of Web Compatibility issues for Mobile and Desktop. After asking the industry on use cases we summarized some of the findings.

Platform Detection

Detection of platform for:
  1. usage statistics by products like Google Analytics
  2. offering targeted download/installation
Alternate Method
Firefox OS can be deduced from the existing UA by grepping for the inclusion of the "Mobile" token and the absence of the "Android" token. This is an implicit declaration of the platform. This use case breaks if the same UA is used in the future for non Firefox OS devices.

Device Capability Detection

Determine device capabilities, such as geolocation, screen resolution, and media decoder support, in order to:
  1. tailor a site's content
  2. limit the availability of Marketplace apps

The implementation is typically some sort of database of capabilities keyed off of UAs.

Alternate Method
Query the device for its capabilities directly via feature detection.

Device Detection

Detection of a specific device in order to offer device specific or free content, such as access to free live video feeds. This may be part of a marketing campaign to promote the sale of a device or a specific brand
Alternate Method
  1. Provide access to content based on the network connection or subscriber id.
  2. Ship an app on device.

Device Type Determination

Similar to Device Capability Detection, determine the type of the device (mobile, tablet, or desktop) in order to send content tailored for the device type.
Alternate Method
Responsive design via CSS media queries. If UA detection is to be used, query for the "Mobi" but not "iPad" token for mobile, "Tablet", "Touch", or "iPad" token for tablet devices.

CPU/Memory Determination

High performance apps like games have minimum processor and memory requirements. These apps need to be able to determine the hardware characteristics in order to ensure a good user experience / smooth game play.
Alternate Method
There is currently no method to query a device for the underlying hardware characteristics.

Specific Device/UI Determination for Documentation

A support system, like SUMO, needs to know the specific device or app version in order to provide appropriate documentation for the user interface. (See bug 915686#c9 for a specific example.) This information is pulled from the UA string.
Alternate Method
Device/app version information is not available via a Web standard API. It may be possible to expose app version via the manifest, although this may not be desirable.