How does one determine the current browser the user uses?

How does one determine the current browser the user uses?

Hi guys.

Check boxes and Multiple Choice controls do not show their populated values in Chrome when I set their enabled attributes to false. This works fine in internet explorer.

Do you have a solution to this issue? My other option is to determine the browser and show the values in a different way.


Ideally, you'll be able to reach a solution that works on all browsers, since browser detection is not very reliable unless you use comercial solutions like WURFL, or DeviceAtlas.

That being said, browser detection is usually done by parsing the user agent string that is sent with a HTTP request and comparing it to known patterns used by browsers. If you open the Silk UI Framework, it contains an action (that isn't public), called detectBrowser and it does just that. I bet that action isn't public because it is not reliable, though.
@Joao: I would think that in general, unless a browser deliberately tries to deceive you, it's pretty reliable detecting what you have in front of you by parsing the user agent.

@Jean-Pierre, can you post a minimal eSpace that shows this problem? I've never heard of this problem (and never experienced it), so I bet there must be something wrong with the code itself, rather than the browser.

@Killian: Browsers do try to deceive you! Coding for specific browsers is usually frowned upon by browser developers, so you have things like the MS Edge user agent string, which says it is compatible with every other major browser:

Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136

Of course it is still possible to detect that this string belongs to Edge, since it says Edge right there, but adding that check would require someone to write an additional line of code, which means realiable browser detection requires some maintenance effort and attention to new releases.