Re:Let's use more of Firefox, only YOU can stop Chrome from ...
by bichiliad on Saturday June 27, 2020 @01:31AM
(#23659738)
It looks like using an approach like Modernizr relies on downloading the detection code, running it, and then potentially kicking off additional downloads for polyfills. Or it would mean eagerly downloading polyfills on browsers that don't need them. In the former case, you pay the cost of a second network request, especially in older browsers that don't support HTTP/2, and in the latter case, you send a potentially large number of bytes of polyfill code to clients that don't use them. What makes using a browser's agent string an anti-pattern?
[ Parent
| on HN ]
Re:Let's use more of Firefox, only YOU can stop Chrome from ...
by omnimus on Saturday June 27, 2020 @03:42AM
(#23660180)
The fact that you have no guarantee the agent string is correct. No guarantee your polyfills and your code works.
Re:Let's use more of Firefox, only YOU can stop Chrome from ...
by bichiliad on Saturday June 27, 2020 @11:28AM
(#23662421)
You don't really have much of a guarantee about anything from the client when they make a request. You have to take them at good faith when they report a user-agent to you. Plus, from real-world experimentation, I'm relatively confident that the performance benefits of the solution I mentioned outweigh the cost of supporting browsers that spoof their user agents: