title: Detect device types from user agent strings
body: <p>I am trying to detect "desktop", "mobile", and "tablet" from user agent strings. What I need is just these three rough categories. Brand and device names are not needed. Some examples of user agent I have are:</p>
  
  <p>"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)"</p>
  
  <p>"Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36"</p>
  
  <p>Is there any existing API can do this? </p>
  
  <p>According to the very last sentence of <a href="https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent" rel="nofollow">this article</a>, it seems that looking for keyword "mobi" in a user agent string can handle most cases. But it seems too easy to be true......</p>