Device Capabilities Detection Proxy
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.
The devcaps experiment was started for a couple of reasons:
Server-side customization of mobile web applications is currently necessary if you are going to build effective and efficient mobile web apps.
Current device detection techniques tend to use either
WURFL or naive
to determine the device that is accessing the site.
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.
The devcaps handshake process is similar in execution to the way authentication is implemented in most web applications:
The devcaps cookie format has been revised and is now even more compact. The
following is a good example of a valid
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.
+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.
Copyright (c) 2014 Damon Oehlman email@example.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.