Revision: 61603
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 26, 2012 04:36 by chrisaiv
Initial Code
var ua = request.headers['user-agent'], $ = {}; if (/mobile/i.test(ua)) $.Mobile = true; if (/like Mac OS X/.test(ua)) { $.iOS = /CPU( iPhone)? OS ([0-9\._]+) like Mac OS X/.exec(ua)[2].replace(/_/g, '.'); $.iPhone = /iPhone/.test(ua); $.iPad = /iPad/.test(ua); } if (/Android/.test(ua)) $.Android = /Android ([0-9\.]+)[\);]/.exec(ua)[1]; if (/webOS\//.test(ua)) $.webOS = /webOS\/([0-9\.]+)[\);]/.exec(ua)[1]; if (/(Intel|PPC) Mac OS X/.test(ua)) $.Mac = /(Intel|PPC) Mac OS X ?([0-9\._]*)[\)\;]/.exec(ua)[2].replace(/_/g, '.') || true; if (/Windows NT/.test(ua)) $.Windows = /Windows NT ([0-9\._]+)[\);]/.exec(ua)[1];
Initial URL
http://stackoverflow.com/questions/6163350/server-side-browser-detection-node-js
Initial Description
Browser detection before sending any resources to the client.
Initial Title
NodeJS: Server-side browser detection
Initial Tags
javascript
Initial Language
JavaScript