History of the browser User-Agent string
Translator: A very old article, if you are not familiar with the history of the browser User Agent (like me), then this article should be very helpful, and the comments on the original article are very interesting
Originally there was a browser calledNCSA Mosaic.Mosaic self-proclaimedNCSA_Mosaic/2.0 (Windows 3.1)
, it can display some pictures and text, which is very exciting.
And then, there was this thing calledMozillaMozilla’s new web browser, whose name stands for “Mosaic Killer.”But Mosaic didn’t think it was funny, so Mozilla renamed itNetscapeAnd claimed to beMozilla / 1.0 (Win3.1)
.Netscape
Popular frameworks were supported, but Mosaic didn’t support them, so “User Agent sniffing” was born, and people only contributed frameworks to Mozilla webmasters, not to other browsers.
Then Netscape said, let’s laugh at Microsoft and call Windows a “hard-to-debug device driver,” and Microsoft took offense. So Microsoft came up with something calledInternet Explorer
(Internet Explorer) and wanted it to beNetscape killer
.It didn’t want to wait for webmasters to learn about IE and contribute frameworks to it. So, IE declared itself “Mozilla compatible” and started mimicking Netscape, as it called itselfMozilla / 1.22 (compatible; MSIE 2.0; Windows 95)
Then IE began to receive frameworks from other places, to the delight of everyone at Microsoft and the confusion of webmasters.
Microsoft then used Windows to rapidly expand IE and make it better than Netscape, and the first browser wars broke out in this land.Then Netscape was killed, and Microsoft was happy. But Netscape made a comeback under the name Mizilla, and former colleague Mozilla developed a very good rendering engineGecko
“And called himselfMozilla / 5.0 (Windows; U; Windows NT 5.0; en-US; The rv: 1.1) Gecko / 20020826
. Mozilla then came up with what we know as Firefox, which it calls FirefoxMozilla / 5.0 (Windows; U; Windows NT 5.1; sv-SE; The rv: 1.7.5) Gecko / 20041108 Firefox / 1.0
.Then Gecko became widely used, and other browsers began using its code, some calling themselvesMozilla / 5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; The rv: Gecko / 20040825 Camino / 0.8.1 1.7.2)
Some call themselvesMozilla / 5.0 (Windows; U; Windows NT 5.1; de; The rv: 1.8.1.8) Gecko / 20071008 SeaMonkey / 1.0
, each masquerading as Mozilla, and they’re all powered by Gecko.
As Gecko grew, “User Agent sniffing” came back, and the community contributed some nice code to Gecko that wasn’t available in other browsers, so IE failed again.Linux enthusiasts are sad because they have developed itKonqueror
And its engine isKHTML
They think it andGecko
Just as good, but it’s notGecko
So it is not provided with some good pages, thereforeKonqueror
Start masquerading asClass type GeckoTo get some good pages and call themselvesMozilla / 5.0 (compatible; Konqueror / 3.2; FreeBSD) (KHTML, like Gecko)
You can see there’s a lot of confusion here.
Then Opera said, “We really should allow the user to decide which browser to emulate,” so Opera created a menu item,And called himselfMozilla / 4.0 (compatible; MSIE 6.0; Windows NT 5.1; En) Opera 9.51
orMozilla / 5.0 (Windows NT 6.0; U; en; Rv :1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 9.51, or Opera/9.51 (Windows NT 5.1; U; en)
, the user can choose between the two types.
Then Apple came up with Safari, which usesKHTML
Engine, but added a lot of features to the engine, and split the project off and called itWebkit
.But Apple still wants to beKHTML
Write pages, so Safari calls itselfMozilla / 5.0 (Macintosh; U; PPC Mac OS X; De-de) AppleWebKit/85.7 (KHTML, like Gecko) Safari/85.5
In contrast to the above confusion the situation is getting worse.
Microsoft was so scared of Firefox that it dusted it off with IE and called it Mozilla/4.0 (Compatible; MSIE 8.0; Windows NT 6.0), and it renders fine code, but only if the webmaster instructs it to do so
Then, Google developedChrome, using theWebkit
The engine, just like Safari, wants to build pages for Safari, so it masquerades as Safari.So Chrome is usedWebkit
And disguised as Safari,Webkit
Disguised as aKHTML
.KHTML
Disguised as aGecko
, all browsers pretend to be Mozilla, Chrome claims to beMozilla / 5.0 (Windows; U; Windows NT 5.1; En-us) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13
The User Agent is a mess, almost useless, each one masquerading as something else, and really messed up
(Full text)
Let me tell you something about my feelings
Take a couple of browsers on my own machine
- Chrome 69: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
- Safari 12: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Safari/605.1.15
- Firefox Nightly 59.0 A1: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; The rv: 59.0) Gecko / 20100101 Firefox 59.0
At first glance, it’s tedious and similar, and I’m just looking at some of the current mainstream browsers. The UA of some niche browsers may contain a lot of other miscellaneous information
As for UA, I didn’t pay much attention to it before. After reading this article by chance, I found that the history of UA is just like the iteration of most of our old projects. The code is wrapped layer by layer, and the user Agent is wrapped layer by layer. So guessing what browser a user is using is a pretty lame way to do it, and it would be nice to have a simple, efficient, straightforward way to tell which browser a user is using
Related articles
- Browser Detection is Bad
- Mosaic