4 ms·
Is there any reason why we couldn't have all browsers on all platforms use the same user agent header? I realize some sites use the user agent as a crude form o
by Ajedi32 8y ago
Is there any reason why we couldn't have all browsers on all platforms use the same user agent header? I realize some sites use the user agent as a crude form of feature detection, but it's my understanding that that's generally considered to be bad practice.
- wongarsu 8y agoApart from the difficulty of obscuring this information from JavaScript, it's politically impossible. Chrome could change its header to the header of a competitor or a neural one, but has no reason to (Google's main business is delivering ads). For other big browsers like Firefox and Safari it would be a huge loss to change the header: they would vanish from browser market share statistics, and with that the business case to make websites work well with their browser dwindles. That in turn would reduce their actual market share. That only leaves the browser with a market share so tiny they are ignored by developers, and those browsers do often spoof the user agent header (or at least make it very convenient to do so).
- dumbmatter 8y agoSometimes there are browser bugs that are impossible to do feature detection for, in which case have no better option than looking at the user agent. For instance, several versions of Firefox had a serious bug in shared workers, which appeared intermittently when users opened your site in multiple tabs https://stackoverflow.com/questions/51092596/feature-detection-for-firefox-57-shared-worker-bug https://stackoverflow.com/questions/51092596/feature-detecti... - I had to use the user agent to work around this.
- EastSmith 8y agoSure, this is a fair use case. But then can't the browser tell the end user that someone wants to read this browser data so the user has a chance to say "no"?
- dredmorbius 8y agoChanging user-agent is virtually always possible, though a vanishingly small fraction of users will do so. Bundling into adblockers or browsers directly would help.