Never trust the user string to be accurate - many tablets and phones especially may mislead. To confirm the ability of the browser/platform use a specific test where available.
For example on Firefox OS devices.
User-Agent: Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0
var ua = navigator.userAgent;