As mentioned by @Jason "Its a long story". Summing that story up "its just every browser pretends to be Mozilla"

After trying everything, I have finally used: http://www.useragentstring.com/

You can use the above website to get the formatted user agent and OS.

They have an API which you can use directly...