JavaScript Device Detection

Web gurus determined that processing the user agent of the browser is a pointless approach to adapt the user experience to the actual device being used to navigate the site. All that matters-they say-is the screen width and for that we have CSS media queries and even higher level frameworks such as Bootstrap. Media queries are not pure gold and while they sometimes offer a quick and acceptable solution media queries completely fail the point of detecting whether the device is mobile or not. For a media query expression a mobile phone and a resized browser window are just the same. This may or may not be an issue for all applications but if you want to intelligently serve ad hoc markup from the server or request ad hoc content (i.e., images) for the device you must be informed about the form factor of the device and process the user agent. Should you do that yourself? That's crazy, but a JavaScript-based solution exists for both the client and the server (node.js environment). The talk presents a couple of JavaScript frameworks to perform effective device detection and image processing.

Dino Esposito

Dino Esposito

A long-time trainer and top-notch consultant, Dino is the author of many popular books for Microsoft Press which have helped the professional growth of thousands of developers and architects. CTO of a fast-growing company providing software and mobile services to professional sports, at the moment Dino is also a technical evangelist and a member of the team that manages WURFL – the database of mobile devices used by organizations such as Google and Facebook. Recently, Dino co-authored (along with Andrea Saltarello) the second edition of bestseller Microsoft .NET: Architecting Applications for the Enterprise (Microsoft Press). Follow Dino on Twitter: @despos