- PHPNuke SEO Search engine optimization, professional tools including nukeSEO, nukeSPAM, nukeFEED, nukePIE, nukeWYSIWYG and more


. Welcome to  ! 

Tag This

. . .
 Mobile device detection options 

(EDITOR'S NOTE: This is an article in progress - please check back for updates)

Modern, mobile, social. It's a theme for RavenNuke™ 3.0. The mobile part is especially interesting. Spasticdonkey and others have been looking into mobile theme support, which raised my question: what is the best way to detect mobile devices?  A little research yielded several options that fall into 2 categories: locally installed scripts that parse the browser's HTTP Header (mainly the User-Agent) and cloud / hosted services with a device description repository (DDR) - a database of device information - which can usually be installed locally for a higher price.

Which approach is right for your site? That depends on a number of factors:

  • What / how much device information you need
  • Cost
  • Performance

Let's look at the DDR services, including Scientiamobile's WURFL, Device Atlas, Handset Detection, and OpenDDR, and the popular PHP mobile detection scripts, including MobileESP, Detect Mobile Browsers, and Mobile Detect.

HTTP Header Parsing

First, let's clarify that the information used to detect a device is passed from the browser through the HTTP header.  This includes:

  • User-Agent ($_SERVER["HTTP_USER_AGENT"])
  • X-Wap-Profile ($_SERVER["HTTP_X_WAP_PROFILE"])
  • Profile ($_SERVER["HTTP_PROFILE"])
  • Opt

X-Wap-Profile and Profile contain and Opt may contain a reference (technically a namespace reference) to an Open Mobile Alliance UAProf document (an XML file) which contains details about the connected device.  However, the UAProf standard is not supported by all mobile devices. Furthermore, a mobile device can have multiple UAProf profiles.

Assuming PHP is able to retrieve the UAProf device information, what does it contain?  UA Prof information is grouped into components:

  • HardwarePlatform (e.g. vendor, model, screen size, text input capability)
  • SoftwarePlatform (e.g. OS, version, supported content types, supported character sets)
  • BrowserUA (e.g. browser name, version, XHTML / HTML versions, Javascript support)
  • NetworkCharacteristics (e.g. supported encryption methods, Bluetooth version)
  • MmsCharacteristics (e.g. MMS max message size, max image resolution, supported character sets)
  • PushCharacteristics (e.g. supported WAP Push character sets, encoding, content types, max message size)
  • WapCharacteristics (e.g. DRM capability, WAP version)

Unless your site needs to differentiate based on this information, the inconsistencies, complexity and overhead might not add value. Although the screen size might be useful for sizing images, it only represents the maximum size supported by the device - not the current zoom level or orientation. So, several approaches simply use the User Agent to detect whether or not a device is mobile.  The tools parse data from the HTTP User-Agent attribute to determine if a device is mobile and, in some cases, if a device is a tablet.  They can usually detect the operating system and the browser.


Attribute / Tool Detect Mobile Browsers Mobile Detect Mobile-Detection MobileESP
License free / unlicense MIT LGPL Apache 2.0
Version / Date n/a August 3, 2012 April 5, 2012 April 11, 2012
Mobile / Tablet / Game Mobile Mobile / Tablet Mobile All
OS Detection N/A Very Good N/A Very Good
Browser Detection N/A Good N/A Very Good

Device Description Repositories

Several solutions match HTTP Header information against a database of device information or use the UAProf information provided by the manufacturer. In some cases, the Device Description Repository (DDR) might be populated from the manufacturer UAProf information, either in advance or on-the-fly.  At least one solution only queries the manufacturers information (and could be used to build a DDR on the fly), so it can also be considered a DDR.  Although DDR information is more detailed than simply parsing the HTTP headers, that detail information might be less consistent, especially if it is not augmented by human editors as the vendor-supplied information varies significantly.

Attribute / DDR 51 Degrees Device Data Device Atlas Handset Detection OpenDDR WURFL ZZap UAProf Parser
License / Cost Mozilla / US$30+/month US$40+/month free (limited) / US$13+/month ODbL (Experimental PHP support) AGPL, US$10+/month GPL, January 31, 2010
Hardware Detection Basic / Very Good Very Good Very Good (including location) Very Good Excellent Good
Software Detection N/A / Good Major Mobile OS Only ? ? Excellent Good
Browser Detection N/A / Very Good ? ? ? Excellent Device Default

 What is the best option for RavenNuke™ CMS?  We'll update this as additional information becomes available and until a decision is made.


. Posted on Tuesday, September 04, 2012 @ 01:04:57 UTC by kguske   .
click Related        click Rate This        click Share

Sorry, Comments are not available for this article.

Page Generation: 0.06 Seconds