Handy tool to detect mobile type (Mobile, Tablet, iOS, Android, etc.) from user agent string. This is based on php Mobile Detect library.
Some examples
Here are few examples for some devices/browsers. Please note that user agent may vary based on device verison etc. We have taken just few specific agents for the purpose of this article.
Galaxy Nexus example
User-agent: Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; Galaxy Nexus Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Mobile detect outcome: {"isMobile":true,"isTablet":false,"isiOS":false,"isAndroidOS":true}
IPad example
User-agent: Mozilla/5.0 (iPad; U; CPU OS 435 like Mac OS X; de-DE) AppleWebKit/533.17.9 (KHTML like Gecko) Version/5.0.2 Mobile/8L1 Safari/6533.18.5 Mobile detect outcome: {"isMobile":true,"isTablet":true,"isiOS":true,"isAndroidOS":false}
iPhone example
User-agent: Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B208 Safari/7534.48.3 Mobile detect outcome: {"isMobile":true,"isTablet":false,"isiOS":true,"isAndroidOS":false}
Chrome example
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31 Mobile detect outcome: {"isMobile":false,"isTablet":false,"isiOS":false,"isAndroidOS":false}
Firefox example
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:19.0) Gecko/20100101 Firefox/19.0 Mobile detect outcome: {"isMobile":false,"isTablet":false,"isiOS":false,"isAndroidOS":false}
Safari example
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/536.26.17 (KHTML, like Gecko) Version/6.0.2 Safari/536.26.17 Mobile detect outcome: {"isMobile":false,"isTablet":false,"isiOS":false,"isAndroidOS":false}