Not-Device Detection

16 10 2008

Over the last 2 years we’ve been refining a simpler and more powerful approach to device detection than everyone else seems to be focusing on.

While WURFL, Device Atlas, etc. are all great resources for very specific capability profiling…we’ve found that turning the problem upside down made much more sense and delivered faster, better results.

The key thing that most developers seem to be trying to do is to identify if a user IS using a specific Mobile Device.

The problem with this is that the User Agent strings on Mobile Devices are inconsistent at best…and completely useless or even non-existent at worst.

Once you accept this the inverse answer becomes clear.

PC browsers are much more reliable and consistent in identifying the Operating System they belong to. Also, there is only a small handful off Operating Systems you need to detect. So this is how our solution works.

We call this !device-detection (“Not Device” Detection).

If your User Agent isn’t one of the following Operating Systems:

- Windows
- Macintosh/Mac OSX
- Linux
- FreeBSD
- Solaris
- (Add niche OSes here)

And your User Agent doesn’t contain one of the following strings:

- bot
- slurp
- spider
- crawl

Then you are almost guaranteed to be on a Mobile Device.

Within this group you can then also clearly identify the important groups that are consistent:

- iPhone/iPod Touch
- Windows Mobile

We have implemented this method for two major Telco’s a major Insurance company, our leading edge Mobile Payment service and our own web projects. This is a strategy that has proven to be very effective and only requires a simple set of regular expressions in the form of Apache mod_rewrite directives that can work in either Apache or IIS.

We also couple this with a simple design pattern that provides a link from the Mobile site back to the PC site just in case we accidentally mis-classify a user. After all they should be able to ask for the full PC version if they really want it.

We’ve also recently put together a case-study that looks at some well known large corporations in Australia to see how they are or are NOT handling automatic device detection. The results are very surprising.

A full copy of the presentation is online on slideshare

Now we thought it’s time we shared this strategy in order to broaden the on-going device detection discussion.