by LocalPCGuy · 7y ago · 0 comments
This... is just wrong. If you start from that base feature set that works on all browsers, and then utilize feature detection to progressively enhance the experience, you can definitely do just what this statement says.
Its just easier to rely on UA sniffing, but don't spread misinformation that it isn't possible. It is a LOT more work, particularly to ensure that the experience is a good as possible on both ends of the spectrum.
It's possible that there is better performance using UA sniffing, as the server can decide what code subset to send. So I don't discount it as a potentially valid solution, but just not as "the only way". Thinking like that is how we end up in situations where "best viewed in ... browser" happens.
A bug that happens 1% of the time due to reasons still unknown, or features or bugs that need something to happen on the user or hardware side to detect.
For example, I had an issue once where when using WebRTC on some devices with 3 rear-facing cameras on android it would horizontally flip the "long range focus" camera. There is no way to feature detect that. Hell there wasn't even a way for me to feature detect that I should use the second of the 3 cameras on that device (the first was a fisheye-style wide angle lens, and the 3rd was a middle-ground lens, but the second worked best for our usecase).
I've also used UA detection on a browser bug that would cause fetch requests to fail if the user went offline for a split second inbetween requests. There is no way for me to detect that before the bug happens, and once it happened the "failures" looked like it just never came back online. UA detection was the only tool I had to fix that until it was fixed at the browser level.
There's a difference between using a user-agent check to find a very specific environment where a bug will occur, and using a user-agent check to determine which of 3 browsers you accept. Used properly, user-agent tests can be a kind of adjacent form of feature detection. Used improperly, and your site is best viewed in IE, even though the user is on a browser that they know will work.
This is also true of your fallback features. They may be implemented incorrectly in an unknown browser too. But it's not reasonable to assume that. You should assume the feature works, unless the UA is on a blacklist.
There are edges where detection falls over.
Mind you, agent string sniffing won't help you either.
But UA sniffing should only be used for absolutely broken browsers. For functional browsers baseline+enhancements is very doable, and unknown browsers should be assumed functional.