https://github.com/faisalman/ua-parser-js, add an ua parser written in js. It provide the browser, device, os and engine.
Maybe it would be better give platform as well.

Use therubyracer and ExtJs to invoke the js library. Very Wonderful.