5 ms·
If they change the UA, why didn't they take this opportunity to get rid of these ridiculously long UA's that mention competing browser brand names, and just mak
by Aardwolf 13y ago
If they change the UA, why didn't they take this opportunity to get rid of these ridiculously long UA's that mention competing browser brand names, and just make their UA string the following:
"Windows NT 6.3; Trident/7.0; rv 11.0"
- lucian1900 13y agoBecause apparently lots of websites still (mistakenly) check for "Mozilla" and "Gecko".
- Aardwolf 13y agoThis is over 15 years ago that IE was related to Mozilla. These "lots of websites", is this about websites from 1995, or modern ones?
- mattbasta 13y agoUnfortunately, yes. Every mom-and-pop PHP-based website that was done by a teenager in the last 15 years probably still does this at some level. There are also plenty of old web servers out there that look for those headers to decide how to respond (to account for browser bugs).
- mtts 13y agoModern ones. Checking for "Mozilla" is one (admittedly not very good) way to check if you're dealing with a browser or with some other kind of user agent, such as a search engine bot or something like that.
- cgore 13y agoI think all the search engines do Mozilla too though. From my server logs: cgore.com:80 218.94.63.53 - - [02/Jul/2013:16:40:57 -0500] "GET / HTTP/1.1" 200 3708 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" http://www.google.com/bot.html)"
- lucian1900 13y agoIronically, probably because servers were returning broken pages, because user agent strings are overloaded.
- BlackAura 13y agoASP.net used to do user agent sniffing extensively. It used it for feature detection, but also to serve different HTML and JavaScript to different browsers. I think it still does, actually, but I've not looked at it in a while. Microsoft obviously thought that user agent sniffing was a great idea until pretty recently, because they use it a lot. Use of user agent sniffing is built right into the framework, and also into Webforms (controls, server-side events, and the like). Often, completely different HTML and JavaScript is generated for different browsers (whether you want it to or not). Worse still - things built on top of ASP.net used user agent sniffing even more. For example, ClickOnce required that the browser report which versions of the .net framework are installed, and the server does different things depending on that information. IE's user agent strings can get very long, reporting the browser version, OS version, CPU architecture, various service pack levels or revisions for different things, half a dozen versions of .Net, Infopath, Windows Media Center, Zune software, whether it's a TabletPC or not, RTC API, and a whole bunch of other fragments that I don't even recognize (SLCC?), and even occasionally advertising that the browser has some malware installed. It's nearly impossible to switch this stuff off in ASP.net, and the browser database is often out of date. So new browsers or browser versions are often served broken pages (because the "unknown browser" fallback doesn't actually work). This happened when IE 10 was released, for example. Existing browsers are often detected incorrectly, and served a degraded version of the page (happened a lot to Firefox and Opera, back in the IE 6 / IE 7 era). At least in ASP.net MVC you can ignore the browser detection most of the time. You can't really disable it in ASP.net itself.
- Recoil42 13y agoFor compatibility reasons. Many websites render differently based on browser support/quirks, and use strings of text within the UA as cues to determine which direction they should take when handling those quirks. Removing those cruddy bits of the UA would make it so that those pages would render incorrectly.
- aclimatt 13y agoThe "Mozilla" part of the user agent has been maintained for historical reasons, and could potentially break compatibility if removed. Originally it was used to detect frames. It may not be used in the majority of user agent sniffers these days, but I doubt Microsoft is interested in testing their luck removing it. http://webaim.org/blog/user-agent-string-history/ http://webaim.org/blog/user-agent-string-history/
- T-hawk 13y agoWe have a real test case. Opera has identified directly as "Opera" not "Mozilla" since forever (unless you configure it otherwise), and at least 95% of websites work fine with it. And of the small minority that do fail in Opera, faulty user agent sniffing could represent only a fraction of those. Opera 12.15 identifies as this for me: Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.15 We could lose that historical crufty "Mozilla" and be fine. Opera has shown us the way.
- skrebbel 13y agoSignificantly more than 95%. Opera has been my main browser for the past 5 years, and in the beginning it wasn't all perfect, but I've had 0 problems on at least 99% of sites in the last 3 years. Opera filled the last holes and devs became better. Interestingly, some high-profile applications such as Basecamp still suck in Opera, for no apparent reason.
- kibibu 13y ago> some high-profile applications such as Basecamp still suck in Opera, for no apparent reason That's interesting, and I can see it being potentially self-perpetuating. It's broken because Opera numbers are too low to allocate resources to fix, because nobody uses Opera on their site (more than once) because it's broken, because Opera numbers are too low...
- resu_nimda 13y agoNot being very familiar with browser standards, I found this bit pretty funny: navigator.appName is now set to “Netscape” This may seem like a sneaky attempt to trick developers, but this behavior is actually specified in HTML5.
- eCa 13y agoThis seems like a way to force developers to use the correct way to detect which browser is used: Check for the specific thing you want to do.
- sp332 13y agoI thought it was because (when the standard was defined) some web servers would only serve compliant content to Netscape browsers. edit: according to aclimatt, it was used for frames detection.
- samatman 13y agoI like the idea that in a thousand years, two pieces of code may well be asking one another: "What is the Navigator?" "Netscape", for absolutely no reason, in a piece of ancient, sealed code that no one but a classics scholar would touch.