5 ms·
UA is advertisement (heh) of features. Why shouldn’t you use what the browser tells you?
by techslave 7y ago
UA is advertisement (heh) of features. Why shouldn’t you use what the browser tells you?
- tristador 7y agoThink about the mapping between features and UA strings. Over time features are added or removed. So those mappings grow stale. Check out feature detection vs browser detection, it explains some of the challenges to relying on user agent strings. I think the rule is: detect features, don't rely on unreliable proxies for features. https://mobile.htmlgoodies.com/html5/client/browser-and-feature-detection-make-your-website-look-great-everywhere..html https://mobile.htmlgoodies.com/html5/client/browser-and-feat...
- mattnewton 7y agoI agree with that advice for most sites, especially SPA's, 100%. But Google search has some weirdly specific requirements. It needs to know if it can show a result that required a polyfill mere ms after it gets your request, for example, or if it would be better to just send less bytes and a scaled down version of the same result that might need different data to assemble. It's not perfect but a UA string is one of the only practical ways to do this. Having qa and engineers to keep track of this mapping for the most commonly used browsers may make sense for search to shave off a bunch of time shipping js and doing feature detection to figure out what it needs next, but may not make sense for your website. In general there are no blanket general guidelines that apply to every single site regardless of usage patterns or business needs. Disclaimer: Former web search eng, current Googler.