-
-
Save jacobrossi/c9699b27df2f4e97c0bd to your computer and use it in GitHub Desktop.
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0 |
Love how it mentions every user agent ever, except for IE.
How does it helps to kill UA string?
IE10 = true if UAstring.has? 'Mozilla', 'Chrome', 'Safari'
I'm sure this is what some peoples code soon going to be look like.
Well, Opera has something like this:
Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36 OPR/15.0.1147.153
Spartan has less... ;)
IE = /(Edge)\/(\d+)\.(\d+)/.exec(navigator.userAgent)
Not that hard to detect tbh.
Is this the UA that will be emitted by the browser currently known as project Spartan?
Whatever that turns out to be, it's a fair bet it will start with "Mozilla", avoid including the string "msie" and likely toss in some magic strings like "chrome" and "safari".
This is hurting the web. There are good, sensible reasons for wanting to positively ID a browser, not least of which is the fact that feature detection doesn't mean the feature works. There are thousands of cases of feature detects combined with a sneaky (and usually flawed) UA sniff to exclude a browser which passes the feature detect but is known to have a buggy implementation. There are proprietary extensions that only exist in some browsers. There are implementations that are buggy in some browsers in very specific ways. There are features implemented to early specs which then changed.
With the polyfill service I and others are trying to provide a tool to correct those flaws, but you cannot do it accurately or efficiently with feature detection. We would all benefit if user agents were to honestly, accurately and uniquely identify themselves.
I understand that some sites have bad UA parsing. But Microsoft has had similar problems before and found a solution: when IE8 fixed bugs sites were relying on, you added compatibility mode, and a blacklist of sites that would get switched to it by default. Here we need the same thing. So why not be the trailblazer here: set the new UA string to "/" and start a crowd sourced database of sites that require a legacy UA. Have the browser refresh its list daily or weekly.
@triblondon I presume the IE team have found that the number of extant sites where a naïve UA detection is used as feature selector outweigh (both in quantity and collective importance) the sites that use both explicit feature detection coupled with UA identification to exclude UAs with buggy implementations. That this hinders future interoperable website development is a trade-off they were willing to make.
See this blog post for the crazy UA sniffing that some people do, it's no wonder IE has to mention every browser. I agree that UA sniffing can be useful in some cases. The problem is that it's been abused and the abusers have fled the scene or just don't care, leaving the browser makers to fiddle with the UA so their users don't suffer. It's not just IE either, Chrome mentions Gecko and Safari for a reason.
Microsoft, be brave! Let it be just "Edge/12.0"!
Can we please deprecate UA strings already?
Here's wishing for something like navigator.supports.{feature}
.
@silverwind they tried that too and it failed. https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
@silverwind after they all agree to do that in 10 years, IE will insist on using different feature-names.
There must be an entire field emerging: UA archaeologist and lore historian. It's starting to read like the "begats" in the bible. All browsers much connect their lineage to Konqueror or face a lack-of-legitimacy crisis!
Honestly, we wish the UA string didn't have to be a lie (though it is in every browser). If the tokens were stickers, then this looks like the back of my laptop! But this is a necessary change. The reality is that our new engine, EdgeHTML, is further diverged from Trident than even Blink is from WebKit. So its necessary to break those ties. Further, today's web just doesn't work unless you have these other tokens. The number of broken sites is in the thousands. It's also worth noting that we're not just slapping these in there with nothing else, these Chrome/Safari tokens come along with a commitment to quadruple down on interoperability with these browsers. To date, we've made over 3000 interop fixes and are adding over 40 new standards, which makes these tokens more of a white lie. :) Rest assured we understand sniffing is occasionally necessary. We will absolutely maintain a way to confidently identify the new engine (look for "Edge").
It's just some compatibility issue. We have Mozilla keyword in IE UA string from IE9, now we also have Safari and AppleWebKit for the same. :)
One thing I find interesting is that IE itself somehow never made it in this list. Maybe something to strive for in the future. ;)