+title: Context Detection, not capability detection
date: 2011/10/16 15:45:00
+categories: Development, Mobile
+tags: mobile, responsive design, progressive enchancement
+I've been thinking about UA sniffing and capability detection lately. Partly because I have to deal with multiple devices in my [day job] and partly because I have been using [workflowy] recently, which doesn't currently do The Right Thing with my mobile phone. (Workflowy is awesome by the way. You should check it out!)
+Good developers have been recomending feature detection instead of browser detection for as long as there has been features to detect.
+It seems like the single most useful thing you can use UA strings for is to detect the usage context.
+Consider workflowy for a moment. There is one UI for desktop, and desktop-like devices, and there is one for mobile touch devices.
+The former is what you get
+Problem. UA != device. There is not requirement for browsers to report what hardware they are running on. Opera mobile and Firefox mobile will in many cases only report information about themselves, such as browser name and version.
+The capability detection gap
+What can you use capability detection for? Most of the things people use
+There are (at least) two scenarios where server side UA detection is reasonable:
+# Initial page load optimization
+# Device class detection
+Note that I am not saying we shouldn't use media queries etc. What we want to happen is that when the browser applies media queries it already has most of the resources it wants, because they were part of the first load. If we made a poor guess, then the media queries will still kick in and download the right resources.
+UA sniffing for this could be omitted, but using them may lead to a better user experience.
+The second thing one whould use UA sniffing for is finding out the device class. "Device class" is a horrible name, and not at all buzzword worthy? What are better alternatives?
+Anyway, what I mean by device class is if the device is a pc, tablet or phone. Or something else again, like a TV. Or a fridge.
+ : this is a bad name. What is a better one?