For instance, I wrote an IndexedDB-heavy web app. It doesn't work in browsers that don't support IndexedDB. So I do feature detection and if IndexedDB is not supported, I show an error message telling the user that if they want to run the app, they have to use a more modern browser like Firefox, Chrome or IE10.
...except on iDevices, where it is literally impossible to install any browser that supports IndexedDB, despite the fact that it is possible to install something called "Google Chrome" that is not really Google Chrome. So I do user agent detection to display a different message to those users, so as to not give them false hope and confusion.
Admittedly I could invest more time to try to get it working, but iOS represents a relatively small fraction of my users and even a working shim could have problems (IIRC there are serious bugs with WebSQL in iOS 7, not sure if they've been fixed; also, I don't know what this shim approach would do to performance in an IndexedDB-heavy app).
It's not at all trustworthy, but in practice it's useful.
The user agent (UA) string is used by almost every major web brand for one or more of the following purposes:
- To serve different levels of experience to different classes of browsers. This is necessary if you want global coverage i.e. all classes of devices and connectivity. The payload of desktop version of Google is fully 140x bigger than the lightest mobile version, Facebook is similar (check this on http://prism.mobiforge.com). RWD can't do this (many RWD sites simply don't load at all on lower-end phones).
- Serving different experiences to different types of devices e.g. desktop / mobile / TV etc. Don't think this is necessary? Try some of the sites mentioned with a different UA strong and see how it feels.
- Analytics. Google Analytics, Omniture etc. all rely on the UA string to identify types of devices/browser.
- To offer links to the correct app stores for the various mobile OSes
- To make sites faster/lighter for lower end devices. This is important for low-speed connections, faster page loads, metered data plans.