3 ms·
The real question is, is this still needed in the modern web? I have never used the user agent to serve different content. I do expect that some sites still use
by gnur 13y ago
The real question is, is this still needed in the modern web? I have never used the user agent to serve different content. I do expect that some sites still use the user agent for detection of mobile browsers but that is also deprecated for people with common sense..
- mherdeg 13y agoThe User-Agent field is a great way to detect a polite robot (and even, if it supports robots.txt, to ask it to avoid certain pages). So this header field is a useful signal for analytics. It's not at all trustworthy, but in practice it's useful.
- streptomycin 13y agoIt's still needed in many cases. 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.
- Touche 13y agoYou can use a polyfill that falls back to WebSQL (Supported on iOS): http://nparashuram.com/IndexedDBShim/ http://nparashuram.com/IndexedDBShim/
- streptomycin 13y agoI tried that and couldn't get it to work. Seems I'm not the only one with problems https://github.com/axemclion/IndexedDBShim/issues https://github.com/axemclion/IndexedDBShim/issues 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).
- inafield 13y agojQuery does not actually solve every possible cross-browser compatibility issue. I still occasionally have to code around some browser issue, especially considering the lack of good plugins to support localStorage.
- jmpe 13y agoOff course it still has its use. It comes in handy when you forget your d-link router password.
- ronancremin 13y agoYes. 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 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.
- gnur 13y agoAh good point. But what I really meant, and that isn't really clear from my post: Is wether we still need the addition crap that is in a user agent string. A user agent should be more like this: <Operating System> <version>, <browser> <version>, <devicetype>, <connection type>(high speed unmetered, 3g metered etc)