Detecting device type based on User-Agent
Basic logic:
var ua = navigator.userAgent; for (var re in RULES) { if (ua.match(re)) { return RULES[re]; } }
Device detected: