所有流行的浏览器的用户代理字符串,甚至Internet Explorer的,都以Mozilla/开头。为什么会这样呢?


当前回答

因为这就是网景对自己的定位,而微软想要与那些能够检测网景并拒绝其他任何东西的网站合作。

其他回答

我认为这与http://en.wikipedia.org/wiki/User_agent#User_agent_spoofing有关

在早期,网景(代号Mozilla)是IE的主要竞争对手,他们希望避免被拒绝网景以外浏览器的网站拒绝。

因为这就是网景对自己的定位,而微软想要与那些能够检测网景并拒绝其他任何东西的网站合作。

正如@Jason所说,“说来话长”。总结一下这个故事“只是每个浏览器都假装是Mozilla”

在尝试了一切之后,我终于用到了:http://www.useragentstring.com/

您可以使用上述网站获得格式化的用户代理和操作系统。 他们有一个你可以直接使用的API…

这是一个漫长而悲伤的故事。

总而言之:

Mozilla browser gets released, with User-Agent Mozilla/1.0 (Win3.1). It is publicly renamed to Netscape, but in its User-Agent it keeps its original name . Internet Explorer is released. It spoofs Netscape by starting its User-Agent with Mozilla/ because web servers were routinely browser sniffing and serving pages with frames - a feature supported by both Netscape and IE, but not other browsers of the era - to Netscape only. Over time, Gecko, Konqueror, Opera, Safari and Chrome each decide to similarly spoof the User-Agent of some previous browser in order to manipulate browser-sniffing web pages into correctly understanding their browser's features. As part of this spoofing, all the browsers start their User-Agents with Mozilla/, like the browsers before them had done. Plenty of other nonsense also results, like modern Chrome's User-Agent simultaneously claiming to be Mozilla, Chrome, Safari, and 'like Gecko'.

Mozilla/5.0是表示浏览器与Mozilla兼容的通用令牌,目前几乎所有浏览器都使用它。 更多详情请点击这里