Simply add mobile-useragent-info.js to your page. The Mobile UA and Platform detected by the library will be available in wpcom_mobile_user_agent_info.matchedPlatformName, and wpcom_mobile_user_agent_info.matchedUserAgentName.
The library also exposes a set of functions like 'isAndroid', isOperaMini, etc, you can use in your code.
Available online here: http://js-ua.eritreo.it
If you found a mobile browser or platform this library fails to recognize, feel free to submit an issue. Please provide the user agent string. And well, if you also want to provide the patch, it's even better.