Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Description of the devcaps device discovery process
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
design
template
test
.gitignore
.travis.yml
README.md
codes.js
index.js
package.json

README.md

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.

NPM

experimental Build Status

Why devcaps?

The devcaps experiment was 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.

Cookie Format

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

License(s)

MIT

Copyright (c) 2014 Damon Oehlman damon.oehlman@gmail.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.