We are building a bookmarklet, and we are wondering if we can detect on client side with JavaScript the browser and version number more accurately than doing that on server side using the agent.
We would push the detection results to the server for the main request.
The questions is, can this approach work better and be more accurate? Or both can do the same mistakes and JavaScript itself computes from the user-agent (which can be changed by plugin/proxy).
IMPORTANT
Please don’t forget that we are building a bookmarklet and so we can’t load fancy tools like Modernizr and JQuery as it doesn’t work out fast.
I might be wrong, but I think that JS also uses the user agent. So far I haven’t seen a JS browser detect code that doesn’t compute from the user agent. Correct me if I am wrong. If this helps you try the JQuery
$.supportproperty for detection/support for particular features that you need rather than relying on browser name and version. It is easy to fake your user-agent.According to the this the
navigatorobject uses the user-agent header.