devcaps

Device Capabilities Detection Proxy

npm install devcaps
4 downloads in the last month

devcaps - Device capabilities discovery

It's like Modernizr for the server-side. In actual fact, the devcaps approach is simply a technique for invoking client-side detection as required and passing that information to the server side.

Build Status

Why devcaps?

The devcaps project has been started for a couple of reasons:

  1. Server-side customization of mobile web applications is currently necessary if you are going to build effective and efficient mobile web apps.

  2. Current device detection techniques tend to use either WURFL or naive User-Agent detection to determine the device that is accessing the site.

  3. We can do better. For clientside development we have progressed beyond the dark ages of User-Agent Sniffing to much more reliable (and useful) Feature Detection techniques. It's time that did something to bring these techniques to the server side.

Handshake Process

The devcaps handshake process is similar in execution to the way authentication is implemented in most web applications:

  1. Check for a devcaps cookie.
  2. If the devcaps cookie does not exist, then run the detection routine.

This repository includes a reference implementation for NodeJS for the devcaps implementation which should be compatible with connect middleware, although it has been tested primarily with union.

The devcaps cookie format has been revised and is now even more compact. The following is a good example of a valid devcaps cookie:

+2d+sk

The above cookie (which indicates that both canvas and websockets are supported) is an example of Modernizr properties that have a shortcode associated with it. If a Modernizr capability is tested for that does not have a corresponding shortcode, this will be included in the cookie in it's full form.

For example, +2d+sk+canvastext would be a valid cookie value if a test for Modernizr.canvastext had been requested and passed. Of course, if a short code is eventually included canvastext then the shortcode would be used here instead.

Detection Routine

To be completed.

npm loves you