The landscape of web enabled devices is drastically changing at a rapid pace. Device detection is no longer a reliable solution to adapt with the changes we are seeing in the technological world. The amount of new web enabled devices being released is just too high.
A question of reliability
Device detection cannot reliably report the features of every device users are using to access the web. The main reason is that to know what features a device supports, you must check for them, after the code has been executed on server. Feature detection, currently, can only be done client-side. There are ideas to offer feature detection on the server, yet this option is not available today.
One possible workaround for this lack of knowledge of supported features of the device accessing the website before sending the website over the wire is to use a service that provides a list of supported features related to the user agent. While this can work for some devices, it’s not without it’s own drawbacks.
The difficulty of keeping up with every new web enabled device and testing it and making sure it’s features are added to a database is no small task. It’s a maintenance nightmare as well as a costly endeavor. If one major company decides to break away from standards you rely on for device detection and feature pairing based on the user agent, the whole technique becomes less reliable.
For device detection to be accurate, it must be reliable. For device detection to be reliable, it must be tested on all of the new devices and maintained to make sure does not produce major false positives. This task is becoming more and more challenging.
(Credit: Jeremy Keith)
A more future-friendly solution for adapting to this change is to move beyond device detection and to rely on feature detection alone.
Device Detection != Feature Detection
One common pattern I saw with device detection when I was working on Categorizr and looking at other projects, new and old, was too assume features based on the type of device. For instance, it was, and unfortunately still is, common for people to talk about how mobiles and tablets support touch and desktops do not. This is simply not true anymore.
Feature Detection != Device Detection
I will admit, it’s difficult to move beyond device detection. We want our websites to be suitable for and to work on as many devices as possible. Yet relying on user agents to determine features is not reliable, though we continue with this same set logic. We just reverse it. I’m sure you’ve all seen a list of media queries designed specifically for the iPhone or the iPad. Or maybe the misconception I brought up previously, that we can rely on detecting touch support to determine what type of device a user is on. These are not only silly, but have become tiring to see over and over.
If you believe device detection != feature detection, you must accept that, feature detection != device detection.
Move beyond device detection through feature detection. Let feature detection be just that, feature detection. The lines we’ve drawn in the sand to differentiate devices are fading away. We are seeing this with Windows 8 tablets and laptops/desktops. But we are also seeing the lines between mobile and tablet blur.
Once you move beyond device detection, you will be better prepared to adapt to the constantly changing landscape of web enabled devices.
In the end
I know so far I’ve painted a pretty grim picture of device detection. Though I know there are times where, for whatever particular reasons, it may be best for a project if, you can tell if a device is mobile and create a separate website for users on these devices. Even if you are creating separate website, I encourage you to include a client-side feature detection solution to help the adaptability of your site based on real results, rather than assumptions of what features your device class may support.
The Web is changing and if we wish to keep up with it, we too, must change the ways to adapt to it.