4 ms·
Disclaimer: I work at Google but not on YouTube, speaking in a personal capacity. Long story short, it doesn’t really work this way. As an example, go to goog
by jchw 7y ago
Disclaimer: I work at Google but not on YouTube, speaking in a personal capacity.
Long story short, it doesn’t really work this way.
As an example, go to google.com on Internet Explorer 6. No, I’m serious. You will find that it loads just fine and even functions, over plain HTTP. It’s only a small subset of functionality, but it does actually work.
You can’t do that with feature detection.
YouTube may have crossed the threshold where feature detection should be usable for all of the supported platforms and fallbacks, but feature detection is not a panacea; it does take time to execute feature tests, and it can be difficult to detect certain bugs.
Most web developers are definitely not Google, and shouldn't copy what Google is doing without knowing that they need to. It’s generally ill-advised to copy things without understanding them anyways.
Not assuming malicious intent makes sense to me; the Edge user agent was already very tricky due to the fact that it has long pretended to be Chromium anyways.
- 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.
- jrochkind1 7y ago"malicious intent" is an interesting concept. I agree it seems unlikely this particular feature/engineering choice was introduced with the conscious intent to penalize non-Chrome browsers or Edge specifically by withholding a UI from them. However, when this kind of thing happens, it can be taken as indication that supporting all browsers as well as possible is not as high a priority as other things. Supporting Chrome very well may be a higher priority than supporting every/any other browsers as well as possible. After all, doing it in a "feature detection" way may very well be very difficult and thus expensive/time consuming. But it can surely be done. It just means doing it isn't a high enough to priority to justify what it would take. The sort of decisions anyone developing software needs to make all the time, that's real. And the priorities and values explicitly or implicitly chosen are real too. Is it "malicious intent" to not be willing to put an arguably inordinate amount of resources into supporting non-Chrome browsers, or to effectively prioritize the Chrome UX more than other browsers? I dunno, but it's a thing. It's also worth remembering though that the reported issue is in a preview version of the browser (and on a brand new barely-non-preview version of youtube), and I wouldn't be too surprised if it's fixed before it goes out of preview. This is one of the points of having preview releases of course, to find bugs -- both bugs in user-agents and bugs in websites.
- sdenton4 7y agoThis was a dev/nightly build. This article is just outrage bait for the hacker news community...
- tracker1 7y agoMozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134 Hmm... looks like it's entirely practical to look at the Chrome/version for feature detection. And that they are specifically adding Edge/* detection to disable Edge instead of detecting as chrome compatible. Edit, sorry, wrong/old edge above.. new Edge below. Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3800.0 Safari/537.36 Edg/76.0.173.0 And the new "Edg" instead of "Edge" means they likely had to ADD detection to disable it.
- jchw 7y agoYeah, Edge/* is going to detect separately from Chrome. The issue is, prior non-Chromium based versions of Edge would also have a user agent that looks like Chrome as well, so those older versions will need to be treated differently. :( It's the same reason why everything still has Mozilla/5.0. To be completely clear, I am suggesting this is a bug. It even looks like a bug, since it ironically tells you to upgrade to "...Edge" while saying Edge is unsupported.
- AaronFriel 7y agoThis bug is specifically detecting the new version of Edge (which uses "Edg/") and allows users with other strings "E/", "Ed/", and even Spartan based "Edge/". Someone intentionally added code to single out Chromium based Edge.
- vokep 7y ago>As an example, go to google.com on Internet Explorer 6. No, I’m serious. You will find that it loads just fine and even functions, over plain HTTP. It’s only a small subset of functionality, but it does actually work. Why should this be surprising? What at all about google.com requires all the modern fancy javascript? Theres the search bar, which only need be a basic html text input box, and thats 98% of the reason I'll ever be at google.com. I can guess that there are all sorts of little features crammed in that I don't know or care about, and that without the most up to date everything, some of those features may not be possible or may not be as efficient or whatever. Except there's a key phrase as part of that "I don't know or care about" which means its not why I'm at google.com whatsoever. There's an attitude that seems to be common in SV, especially Google, that seems to put way way too much focus on using the latest things and having everything be automated and as low latency as possible....for what? Why? Its cool you can cut so many ms off some request that it pushes the physical limits of the metal, but I don't really care at all, in fact I'll be prompted to get angry, if that request is part of some feature I'm not interested in, and the one I am, is clearly neglected. I know everyone isn't me, but I find often that my peers have similar feelings. Just look at Android Auto for a myriad of examples of significant buggy behavior that Google certainly has the manpower to fix, but chooses not to.