5 ms·
> You can’t do that with feature detection. This... is just wrong. If you start from that base feature set that works on all browsers, and then utilize feature
by LocalPCGuy 7y ago
> You can’t do that with feature detection.
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.
- jchw 7y agoNo, when I say you can’t, I really mean you can’t. If you try visiting https://google.com https://google.com in IE6, you get the other part of the problem. It doesn’t work. The cipher suites are too old.
- Klathmon 7y agoBut there are genuinely things that can't be feature detected. 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.
- Dylan16807 7y agoUA detection for known bugs is very different from UA detection to enable standardized features.
- deleted 7y ago[deleted]
- nicoburns 7y ago@Klathmon 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.
- danShumway 7y agoYou're still talking about progressive enhancement though. 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.
- Dylan16807 7y agoIf you actually want to support IE6 you have to use some abomination of non-HTML as your base feature set, though. 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.
- onion2k 7y agoA really annoying case where feature detection doesn't work is WebGL on a machine with a blacklisted GPU. Everything detection method will report that it works but it won't. The "feature detection" ends up being rendering something and seeing if you got an image or not. There are edges where detection falls over. Mind you, agent string sniffing won't help you either.