看起来像IE11,但闻起来像Firefox?

tech2023-10-15  96

A pre-release build of Windows Blue, Microsoft’s successor to Windows 8, was leaked a few days ago. It may have been intentional or unintentional but the OS was installed, dissected and reported across the web.

微软几天前泄漏了Windows Blue的预发布版本,Windows Blue是Microsoft的继任者。 它可能是有意的或无意的,但是该OS是在网络上安装 , 分解和报告的。

The new OS contained an early version of Internet Explorer 11. A very early version. Probably nearer IE10.01. There’s little new technology to report, but one update caused a storm of controversy on SlashDot and Neowin.net: IE11’s user agent string appears to impersonate Firefox…

新的操作系统包含Internet Explorer 11的早期版本。 可能接近IE10.01。 几乎没有什么新技术需要报告,但是一次更新引起了SlashDot和Neowin.net的争议:IE11的用户代理字符串似乎冒充了Firefox……

Mozilla/5.0 (IE 11.0; Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C; rv:11.0) like Gecko

像Gecko一样的Mozilla / 5.0(IE 11.0; Windows NT 6.3; Trident / 7.0; .NET4.0E; .NET4.0C; rv:11.0)

The ‘MSIE’ string has disappeared and a suspicious ‘like Gecko’ statement has appeared. Cue 1,000 conspiracy theories.

“ MSIE”字符串消失了,并且出现了可疑的“ like Gecko”语句。 提示1,000个阴谋论。

Historically, browser vendors and developers have been doing the user agent dance since the dawn of the web. The problem starts when you attempt to create a cross-browser compatible website:

从历史上看,自网络诞生以来,浏览器供应商和开发人员就一直在做用户代理舞。 当您尝试创建跨浏览器兼容的网站时,问题开始:

A developer creates a website in browser X then tests it in browser Y.

开发人员在浏览器X中创建一个网站,然后在浏览器Y中对其进行测试。 Browser Y fails, so the developer writes browser Y detection routines and serves different code. Everyone is happy.

浏览器Y失败,因此开发人员编写了浏览器Y检测例程并提供了不同的代码。 每个人都很开心。 Browser Y is then updated — but the website now fails because it’s serving legacy code.

然后,浏览器Y进行了更新-但该网站现在因为提供了旧版代码而失败。 The vendor changes the user agent string: detection fails and the site works again. Everyone is happy and we loop back to step one.

供应商更改用户代理字符串:检测失败,站点再次工作。 每个人都很高兴,我们循环回到第一步。

Look at the start of IE11’s user agent string: Mozilla/5.0. The early versions of IE had to masquerade as Netscape because it was the dominant browser and many sites refused to return content to anything else. The situation continues today — IE, Chrome, Safari and Firefox all start with ‘Mozilla/5.0’…

查看IE11用户代理字符串的开头: Mozilla / 5.0 。 IE的早期版本必须冒充Netscape,因为它是主要的浏览器,而且许多站点都拒绝将内容返回给其他任何网站。 这种情况一直持续到今天-IE,Chrome,Safari和Firefox均以“ Mozilla / 5.0”开头...

IE10: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)

IE10: Mozilla / 5.0(兼容; MSIE 10.0; Windows NT 6.2; WOW64; Trident / 6.0)

Chrome 25: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22

Chrome 25: Mozilla / 5.0(Windows NT 6.2; WOW64)AppleWebKit / 537.22(KHTML,例如Gecko)Chrome / 25.0.1364.172 Safari / 537.22

iPad Safari 6: Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25

iPad Safari 6: Mozilla / 5.0(iPad; CPU OS 6_0,例如Mac OS X)AppleWebKit / 536.26(KHTML,例如Gecko)版本/6.0 Mobile / 10A5355d Safari / 8536.25

Firefox 19: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0

Firefox 19: Mozilla / 5.0(Windows NT 6.2; WOW64; rv:19.0)Gecko / 20100101 Firefox / 19.0

You’ll also notice both Chrome and Safari use the same ‘like Gecko’ string as IE11. I don’t recall that bombshell hitting the headlines?

您还会注意到Chrome和Safari使用与IE11相同的“ like Gecko”字符串。 我不记得重磅炸弹成为头条新闻吗?

The biggest change in IE11 is the removal of ‘MSIE’. I suspect that has been done for one reason: to prevent sites serving invalid IE6/7/8 code to modern editions of the browser. Recent releases of IE’s Trident engine are closer to Gecko or WebKit than legacy editions of itself. By removing the ‘MSIE’ string, Microsoft is breaking detection code and making many sites work as they should.

IE11的最大变化是删除了“ MSIE”。 我怀疑这样做是出于一个原因:防止网站向现代版本的浏览器提供无效的IE6 / 7/8代码。 IE的Trident引擎的最新版本比其旧版本更接近Gecko或WebKit。 通过删除'MSIE'字符串,Microsoft破坏了检测代码,并使许多站点正常工作。

The point is: none of this matters. If you’re browser sniffing, you are almost certainly doing something wrong! While it seems an obvious solution, browser sniffing is a fragile technique that introduces more maintenance headaches than it prevents. If you know someone who sniffs, please suggest they close their IDE, step away from their browser and embark on another career.

关键是: 这无关紧要 。 如果您正在浏览器中嗅探, 则几乎可以肯定是做错了什么 ! 尽管这似乎是一个显而易见的解决方案,但浏览器嗅探是一种脆弱的技术,它带来了比它所阻止的更多的维护难题。 如果您认识某个嗅探到某人的人,请建议他们关闭IDE,离开浏览器并开始另一个职业。

翻译自: https://www.sitepoint.com/ie11-smells-like-firefox/

相关资源:jdk-8u281-windows-x64.exe
最新回复(0)