浏览器演化 | User Agent | 浏览器内核

注:本文为 “浏览器演化 | User Agent | 浏览器内核” 相关文章合辑

英文引文,机翻,未校。

为什么无论哪种浏览器用户代理字符串都以 Mozilla 开头?
读完本文,豁然开朗。


30 Years of Browsers: A Quick History

浏览器 30 年:简史

Thirty years ago, Tim Berners-Lee released the WorldWideWeb browser, unleashing the power of the internet and creating a race among the day’s tech giants to dominate how people accessed the web.

By Chandra Steele

February 26, 2021

三十年前,蒂姆·伯纳斯-李(Tim Berners-Lee)发布了万维网浏览器,释放了互联网的力量,并在当时的科技巨头之间引发了一场竞赛,以主导人们访问网络的方式。

img

You’re likely reading this story on a browser. You might take how you access the web for granted, or you might get into passionate Safari vs. Chrome arguments. Either way, the interface has now been with us for 30 years, and its life has not been without controversy.
你可能正在使用浏览器阅读这篇文章。你可能认为访问网络的方式理所当然,或者你可能会参与激烈的 Safari vs. Chrome 的辩论。无论如何,这个界面现在已经与我们共存了 30 年,它的生命历程并非没有争议。

There are five widely used browsers right now (Google Chrome, Apple’s Safari, Microsoft Edge, Mozilla Firefox, and Opera) and they emerged from a long, litigious war. But in the beginning, there was only one. It was created by Tim Berners-Lee, who envisioned a public way to access the internet, which he also happened to have had a tremendous part in building.
目前有五种广泛使用的浏览器(Google Chrome,Apple的Safari,Microsoft Edge,Mozilla Firefox和Opera),它们来自一场漫长的诉讼战争。但一开始,只有一个。它是由 Tim Berners-Lee 创建的,他设想了一种公共访问互联网的方式,而他也恰好在构建互联网方面发挥了重要作用。

A NeXT Computer and a Vision

When the internet was confined to a small group of people, Berners-Lee, who was working at CERN, sat down at a NeXT computer, wrote up a browser, and called it WorldWideWeb. To not confuse it with the information it was the gateway to, it was later renamed Nexus.
当互联网仅限于一小群人时,工作在 CERN 的 Tim Berners-Lee 坐在一台 NeXT 计算机前,编写了一个浏览器,并将其命名为 WorldWideWeb。为了不与它所连接的信息混淆,后来将其重新命名为 Nexus。

When it was time for a browser to make its public debut, Nexus posed a problem: it could only be used on NeXT computers. So the browser was rewritten by several of Berners-Lee’s CERN colleagues, with most of the input coming from intern Nicola Pellow, to work on a broader array of computers. The browser came to be known as a Line Mode Browser because of the line-by-line text input method it used. It was first available across CERN and then was introduced on the alt.hypertext Usenet newsgroup.
当浏览器首次公开亮相时,Nexus 出现了一个问题:它只能在 NeXT 计算机上使用。因此,浏览器被 Berners-Lee 的几位 CERN 同事重新编写,其中大部分输入来自实习生 Nicola Pellow,以便在更广泛的计算机上运行。这款浏览器因其逐行文本输入方法而被称为 Line Mode Browser。它首先在 CERN 内部使用,然后被引入 alt.hypertext Usenet 新闻组。

Putting the Pieces Together

The Line Mode Browser could only handle text and where would the web be if it was just that? Enter Mosaic, a browser that could handle graphics and text, from the National Center for Supercomputing Applications (NCSA) at the University of Illinois at Urbana–Champaign.
行模式浏览器(Line Mode Browser) 只能处理文本,如果互联网只有这样,会怎么样呢?于是出现了 Mosaic,一款可以处理图形和文本的浏览器,来自伊利诺伊大学厄巴纳 - 香槟分校的国家超级计算应用中心(NCSA)。

While Mosaic wasn’t open-source, it was free for non-commercial use. As PC Magazine wrote in 1994, “Mosaic has probably done more to popularize the internet than any other single piece of software has,” thanks to its “snazzy combination of slick design and solid code.” It competed with Cello out of the Legal Information Institute at Cornell Law School, but in 1994, Mosaic was “becoming the most widespread internet browser,” we wrote, pointing to its domination of the Unix internet world.
虽然 Mosaic 不是开源的,但它可以免费用于非商业用途。正如 PC Magazine 在 1994 年所写的那样,“Mosaic 在普及互联网方面所做的工作可能比任何其他单一软件都多”,这要归功于其“巧妙的设计和可靠的代码的组合”。它与来自康奈尔法学院法律信息研究所的 Cello 竞争,但在 1994 年,Mosaic “成为了最广泛使用的互联网浏览器”,我们指的是它在 Unix 互联网世界的主导地位。

But while Mosaic was supported and developed further by the National Science Foundation until 1997, it had some competition from its own creators. Marc Andreessen and Eric Bina left the NCSA in 1994, and went on to found a company they (eventually) called Netscape.
但是,尽管 Mosaic 在1997年之前得到了美国国家科学基金会的支持和进一步发展,它也面临来自自己创建者的竞争。马克·安德森(Marc Andreessen)和埃里克·比纳(Eric Bina)于 1994 年离开了NCSA,随后成立了一家后来被称为 Netscape 的公司。

Marc Andreessen in 1998 (Photo by Bromberger Hoover Photo/Getty Images)
Marc Andreessen in 1998 (Photo by Bromberger Hoover Photo/Getty Images)
Netscape was the beginning of the name-brand browser, but the company originally bore the name Mosaic Communications, and its first product was Mosaic Netscape 0.9. A lawsuit settlement with the NCSA resulted in a name change for the company and the browser.
Netscape 标志着品牌化浏览器的开端,但最初该公司名为 Mosaic Communications,其首个产品是 Mosaic Netscape 0.9。与 NCSA 的一场诉讼和解导致了公司和浏览器的更名。

Netscape Navigator took over the market almost immediately, and continued to dominate it throughout most of the 1990s, peaking at 90% in 1995, according to Visual Capitalist.
Netscape Navigator 几乎立即占据了市场主导地位,并在 1990 年代大部分时间内保持着这一地位,据 Visual Capitalist 报道,1995 年达到了 90%。

The Browser Wars

Meanwhile, Microsoft realized that it had a huge advantage when it came to browsers since most of the world was using machines that ran on the Windows operating system. In 1995, Microsoft bundled a browser called Internet Explorer with Microsoft Plus for Windows 95.
与此同时,微软意识到,在浏览器领域它拥有巨大的优势,因为世界上大多数计算机使用的是运行 Windows 操作系统的机器。1995 年,微软将一个名为 Internet Explorer 的浏览器捆绑到了 Microsoft Plus for Windows 95 中。

Windows 95 launch in 1995
Windows 95 launch in 1995 (Photo credit: TORSTEN BLACKWOOD/AFP via Getty Images)

It didn’t take long for Internet Explorer (IE) to win over most internet users, but that did attract the attention of the US government, which brought antitrust charges against Microsoft for its practice of preventing computer manufacturers from uninstalling IE and installing other browsers. The case was finally settled in 2001, but IE had three more years of being the preeminent browser ahead of it, peaking at 95% of the market in 2003.
Internet Explorer(IE)很快就赢得了大多数互联网用户的青睐,但这引起了美国政府的关注,后者因微软阻止计算机制造商卸载 IE 并安装其他浏览器而对其提起了反垄断诉讼。此案最终在 2001 年达成和解,但 IE 在此后三年时间仍然保持了主导地位,在 2003 年达到市场份额的 95%。

A Contender

By the late 90s, Netscape was limping along. It was acquired by AOL in 1998, several months after Netscape made its browser free to license and released its source code. That allowed for the creation of the Mozilla project, which initially focused on innovation in the Netscape browser, but later branched out on its own. Mozilla 1.0 arrived in 2002, and following the launch of the Mozilla Foundation in 2003, Firefox 1.0 landed a year later. AOL finally pulled the plug on Netscape Navigator in 2007.
到了 90 年代后期,Netscape 的状况不佳。1998 年,Netscape 被 AOL 收购,几个月后 Netscape 将其浏览器免费授权并发布了源代码。这使得 Mozilla 项目的创建成为可能,该项目最初专注于Netscape浏览器的创新,但后来独立发展。Mozilla 1.0 在 2002 年问世,继 2003 年 Mozilla 基金会成立后,Firefox 1.0 于一年后推出。AOL 最终在 2007 年终止了 Netscape Navigator 的支持。

Searching for Something New

Google was founded in 1998, and though it dedicated its early years to search, in 2008, it developed a browser with some hires from Mozilla. Google Chrome had a slow rollout in its initial year, with about 1% of the market, but now it has the largest share, with about 64% of internet users.
谷歌成立于 1998 年,尽管最初专注于搜索业务,但在 2008 年,它从 Mozilla 招聘了一些人员开发了一个浏览器。Google Chrome 在最初的一年里推广缓慢,市场份额约为 1%,但如今它占据了最大的份额,约为 64% 的互联网用户使用。

Doesn’t Fall Far From the Tree

Of course a look at the history of web browsers would not be complete without that other major OS maker, Apple. In 2003, the company released Safari for Macs. While it gave Mac users something proprietary, the browser really came into its own in 2007 with the introduction of the iPhone, when it went mobile. Safari has a quarter of the mobile browser market overall.
当然,回顾浏览器历史时,不能忽略另一家主要操作系统制造商,苹果公司。2003 年,该公司发布了适用于 Mac 的 Safari。虽然它为 Mac 用户提供了一些专有内容,但真正意义上 Safari 在 2007 年 iPhone 推出时迎来了自己的春天,开始了移动浏览器的时代。Safari 在移动浏览器市场占有率达到四分之一。

Modern Times

Thirty years on, it’s a relatively quiet time in browser history. At Microsoft, IE gave way to Edge, which now runs Google’s Chromium engine, and there are a number of alternative browsers for those with specific needs. Apps compete with browsers for eyeballs, but the five major browsers exist in relative peace, for now.
三十年过去了,浏览器历史相对而言进入了一个相对安静的时期。在微软,IE 让位于 Edge,后者现在运行谷歌的 Chromium 引擎,还有许多针对特定需求的替代浏览器。应用程序与浏览器争夺用户的注意力,但目前这五大主要浏览器相对和平共处。


什么是浏览器的用户代理?

What Is a Browser’s User Agent?

img
Your browser sends its user agent to every website you connect to. but what exactly is a user agent, anyway?
您的浏览器会将其用户代理发送到您连接到的每个网站。究竟什么是用户代理?

A user agent is a “string” – that is, a line of text – identifying the browser and operating system to the web server. This sounds simple, but user agents have become a mess over time.
用户代理是一个 “字符串”,即一行文本,用于向 Web 服务器标识浏览器和操作系统。这听起来很简单,但随着时间的推移,用户代理已经变得一团糟。

基础知识

The Basics
When your browser connects to a website, it includes a User-Agent field in its HTTP header. The contents of the user agent field vary from browser to browser. Each browser has its own, distinctive user agent. Essentially, a user agent is a way for a browser to say “Hi, I’m Mozilla Firefox on Windows” or “Hi, I’m Safari on an iPhone” to a web server.
当您的浏览器连接到网站时,它会在其 HTTP 标头中包含一个 User-Agent 字段。用户代理字段的内容因浏览器而异。每个浏览器都有自己独特的用户代理。从本质上讲,用户代理是浏览器向 Web 服务器说 “嗨,我是 Windows 上的 Mozilla Firefox” 或 “嗨,我是 iPhone 上的 Safari” 的一种方式。

The web server can use this information to serve different web pages to different web browsers and different operating systems. For example, a website could send mobile pages to mobile browsers, modern pages to modern browsers, and a “please upgrade your browser” message to Internet Explorer 6.
Web 服务器可以使用此信息为不同的 Web 浏览器和不同的操作系统提供不同的网页。例如,网站可以将移动页面发送到移动浏览器,将新式页面发送到新式浏览器,并将 “请升级浏览器” 消息发送到 Internet Explorer 6。

检查用户代理

Examining User Agents

For example, here’s Firefox’s user agent on Windows 7:
例如,这是 Windows 7 上的 Firefox 用户代理:

Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0

image

This user agent tells the web server quite a bit: The operating system is Windows 7 (code name Windows NT 6.1), it’s a 64-bit version of Windows (WOW64), and the browser itself is Firefox 12.
这个用户代理告诉 Web 服务器很多:操作系统是 Windows 7(代号 Windows NT 6.1),它是 Windows 的 64 位版本(WOW64),浏览器本身是 Firefox 12。

Now let’s take a look at Internet Explorer 9’s user agent, which is:
现在让我们看一下 Internet Explorer 9 的用户代理,它是:

Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)

image

The user agent string identifies the browser as IE 9 with the Trident 5 rendering engine. However, you might spot something confusing – IE identifies itself as Mozilla.
用户代理字符串使用 Trident 5 呈现引擎将浏览器标识为 IE 9。但是,您可能会发现一些令人困惑的事情 ——IE 将自己标识为 Mozilla。

We’ll come back to that in a minute. First, let’s examine Google Chrome’s user agent, too:
我们一会儿再谈这个问题。首先,让我们也检查一下 Google Chrome 的用户代理:

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5

image

The plot thickens: Chrome is pretending to be both Mozilla and Safari. To understand why, we’ll have to examine the history of user agents and browsers.
情节渐入佳境:Chrome 假装是 Mozilla 和 Safari。要了解原因,我们必须检查用户代理和浏览器的历史记录。

用户代理字符串混乱

The User Agent String Mess

Mosaic was one of the first browsers. Its user agent string was NCSA_Mosaic/2.0. Later, Mozilla came along (later renamed Netscape), and its user agent was Mozilla/1.0. Mozilla was a more advanced browser than Mosaic – in particular, it supported frames. Web servers checked to see that the user agent contained the word Mozilla and sent pages containing frames to Mozilla browsers. To other browsers, web servers sent the old pages without frames.
Mosaic 是最早的浏览器之一。其用户代理字符串为 NCSA_Mosaic/2.0。后来,Mozilla 出现了(后来更名为 Netscape),它的用户代理是 Mozilla/1.0。Mozilla 是比 Mosaic 更先进的浏览器 —— 特别是它支持框架。Web 服务器检查用户代理是否包含关键字 Mozilla,并将包含框架的页面发送到 Mozilla 浏览器。对于其他浏览器,Web 服务器发送了没有框架的旧页面。

Eventually, Microsoft’s Internet Explorer came along and it supported frames, too. However, IE didn’t receive web pages with frames, because web servers just sent those to Mozilla browsers. To fix this problem, Microsoft added the word Mozilla to their user agent and threw in additional information (the word “compatible” and a reference to IE.) Web servers were happy to see the word Mozilla and sent IE the modern web pages. Other browsers that came later did the same thing.
最终,Microsoft 的 Internet Explorer 出现了,它也支持框架。但是,IE 没有收到带有框架的网页,因为 Web 服务器只是将这些框架发送到 Mozilla 浏览器。为了解决这个问题,Microsoft 在他们的用户代理中添加了 Mozilla 这个词,并加入了其他信息(“兼容” 这个词和对 IE 的引用)。Web 服务器很高兴看到 Mozilla 这个词,并向 IE 发送了现代网页。后来出现的其他浏览器也做了同样的事情。

image

Eventually, some servers looked for the word Gecko – Firefox’s rendering engine – and served Gecko browsers different pages than older browsers. KHTML – originally developed for Konquerer on Linux’s KDE desktop – added the words “like Gecko” so they’d get the modern pages designed for Gecko, too. WebKit was based on KHTML – when it was developed, they added the word WebKit and kept the original “KHTML, like Gecko” line for compatibility purposes. In this way, browser developers kept adding words to their user agents over time.
最终,当一些服务器开始查找关键字 “Gecko”(Firefox 的渲染引擎),并为 Gecko 浏览器提供不同于旧版浏览器的页面时,KHTML(最初为 Linux KDE 桌面上的 Konqueror 开发)添加了 “like Gecko” 这些词,以便它们也能获取为 Gecko 设计的现代页面。WebKit 基于 KHTML 开发,当时他们添加了词语 WebKit,并保留了原始的 “KHTML, like Gecko” 行以确保兼容性。因此,浏览器开发者随着时间的推移不断向用户代理中添加关键字

Web servers don’t really care what the exact user agent string is – they just check to see if it contains a specific word.
Web 服务器并不真正关心确切的用户代理字符串是什么 —— 他们只是检查它是否包含特定关键字。

Uses

用途

Web servers use user agents for a variety of purposes, including:
Web 服务器将用户代理用于各种目的,包括:

  • Serving different web pages to different web browsers. This can be used for good – for example, to serve simpler web pages to older browsers – or evil – for example, to display a “This web page must be viewed in Internet Explorer" message.
    向不同的 Web 浏览器提供不同的网页。这可以用于好事 - 例如,向较旧的浏览器提供更简单的网页 - 或坏事 - 例如,显示 “必须在 Internet Explorer 中查看此网页” 消息。

  • Displaying different content to different operating systems – for example, by displaying a slimmed-down page on mobile devices.
    在不同的操作系统上显示不同的内容,例如,在移动设备上显示精简的页面。

  • Gathering statistics showing the browsers and operating systems in use by their users. If you ever see browser market-share statistics, this is how they’re acquired.
    收集显示用户正在使用的浏览器和操作系统的统计信息。如果您曾经看到过浏览器市场份额统计数据,那么它们就是这样获得的。

Web-crawling bots use user agents, too. For example, Google’s web crawler identifies itself as:
Web 爬虫机器人也使用用户代理。例如,Google 的网络爬虫将自己标识为:

Googlebot/2.1 (+http://www.google.com/bot.html)

Web servers can give bots special treatment – for example, by allowing them through mandatory registration screens. (Yes, this means that you can sometimes bypass registration screens by setting your user agent to Googlebot.)
Web 服务器可以对机器人进行特殊处理,例如,允许它们通过强制注册屏幕。(是的,这意味着您有时可以通过将用户代理设置为 Googlebot 来绕过注册屏幕。

Web servers can also give orders to specific bots (or all bots) using the robots.txt file. For example a web server could tell a specific bot to go away, or tell another bot to only index certain areas of the website. In the robots.txt file, the bots are identified by their user agent strings.
Web 服务器还可以使用 robots.txt 文件向特定机器人(或所有机器人)下达命令。例如,Web 服务器可以告诉特定机器人离开,或者告诉另一个机器人仅索引网站的某些区域。在 robots.txt 文件中,机器人由其用户代理字符串标识。

image

All major browsers contain ways to set custom user agents, so you can see what web servers send to to different browsers. For example, set your desktop browser to a mobile browser’s user agent string and you’ll see the mobile versions of web pages on your desktop.
所有主流浏览器都包含设置自定义用户代理的方法,因此您可以查看 Web 服务器发送到不同浏览器的内容。例如,将桌面浏览器设置为移动浏览器的用户代理字符串,您将在桌面上看到网页的移动版本。


篇外:Mozilla 之书

使用 Mozilla 系列浏览器访问 about:mozilla 网址,可以看到一段

在这里插入图片描述


浏览器用户代理字符串的 “无间道”

History of the browser user-agent string

NCSA Mosaic

img In the beginning there was NCSA Mosaic, and Mosaic called itself NCSA_Mosaic/2.0 (Windows 3.1), and Mosaic displayed pictures along with text, and there was much rejoicing.
一开始有 NCSA Mosaic,Mosaic 称自己为 NCSA_Mosaic/2.0(Windows 3.1),Mosaic 显示图片和文字,大家都很高兴。

Netscape

img And behold, then came a new web browser known as “Mozilla”, being short for “Mosaic Killer,” but Mosaic was not amused, so the public name was changed to Netscape, and Netscape called itself Mozilla/1.0 (Win3.1), and there was more rejoicing. And Netscape supported frames, and frames became popular among the people, but Mosaic did not support frames, and so came “user agent sniffing” and to “Mozilla” webmasters sent frames, but to other browsers they sent not frames.

随后,一个名为 “Mozilla” 的新网络浏览器出现了,它的名字来源于 “Mosaic Killer”,但 Mosaic 并不觉得好笑,因此公众名称改为 Netscape,Netscape 自称为 * Mozilla/1.0 (Win3.1)*,人们对此更为欢欣鼓舞。Netscape 支持框架,框架流行起来,但 Mosaic 不支持框架,于是便出现了 “user agent sniffing”,网站向 “Mozilla” 发送框架,而对其他浏览器则不发送框架。

nternet Explorer

And Netscape said, let us make fun of Microsoft and refer to Windows as “poorly debugged device drivers,” and Microsoft was angry. And so Microsoft made their own web browser, which they called Internet Explorer, hoping for it to be a “Netscape Killer”.
img And Internet Explorer supported frames, and yet was not Mozilla, and so was not given frames. And Microsoft grew impatient, and did not wish to wait for webmasters to learn of IE and begin to send it frames, and so Internet Explorer declared that it was “Mozilla compatible” and began to impersonate Netscape, and called itself Mozilla/1.22 (compatible; MSIE 2.0; Windows 95), and Internet Explorer received frames, and all of Microsoft was happy, but webmasters were confused.
并且 Netscape 说,让我们取笑微软,将 Windows 称为 “缺乏良好调试的设备驱动程序”,微软很生气。于是微软推出了他们自己的网络浏览器,称为 Internet Explorer,希望它能成为 “Netscape 杀手”。
Internet Explorer 支持框架,但它并非 Mozilla,因此收不到到框架。微软变得不耐烦,不想等待网站管理员了解 IE 再开始发送框架,于是 Internet Explorer 宣称自己 “兼容 Mozilla”,开始冒充 Netscape,并自称 * Mozilla/1.22 (compatible; MSIE 2.0; Windows 95)*,于是 Internet Explorer 能够j接收框架标签,全微软都很高兴,但是网页管理员却感到困惑。

And Microsoft sold IE with Windows, and made it better than Netscape, and the first browser war raged upon the face of the land.
img And behold, Netscape was killed, and there was much rejoicing at Microsoft. But Netscape was reborn as Mozilla, and Mozilla built Gecko, and called itself Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826, and Gecko was the rendering engine, and Gecko was good.
当时微软将 IE 与 Windows 捆绑销售,并改进它,使其比 Netscape 更优势,于是第一次浏览器大战爆发了。
Netscape 被击败了,微软欢欣鼓舞。但是 Netscape 重生为 Mozilla,Mozilla 开发了 Gecko,并自称为 Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826,Gecko 成为了渲染引擎,而且表现不俗。

Firefox

img And Mozilla became Firefox, and called itself Mozilla/5.0 (Windows; U; Windows NT 5.1; sv-SE; rv:1.7.5) Gecko/20041108 Firefox/1.0, and Firefox was very good. And Gecko began to multiply, and other browsers were born that used its code, and they called themselves Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.2) Gecko/20040825 Camino/0.8.1 the one, and Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.8) Gecko/20071008 SeaMonkey/1.0 another, each pretending to be Mozilla, and all of them powered by Gecko.
后来 Mozilla 成为了 Firefox,并自称为 Mozilla/5.0 (Windows; U; Windows NT 5.1; sv-SE; rv:1.7.5) Gecko/20041108 Firefox/1.0,Firefox 表现极佳。Gecko 开始扩散,其他使用其代码的浏览器相继诞生,它们自称为 Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.2) Gecko/20040825 Camino/0.8.1 之一,还有 Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.8) Gecko/20071008 SeaMonkey/1.0,它们都自称为 Mozilla,但实际上都是由 Gecko 驱动。

Konqueror

And Gecko was good, and IE was not, and sniffing was reborn, and Gecko was given good web code, and other browsers were not.
img And the followers of Linux were much sorrowed, because they had built Konqueror, whose engine was KHTML, which they thought was as good as Gecko, but it was not Gecko, and so was not given the good pages, and so Konquerer began to pretend to be “like Gecko” to get the good pages, and called itself Mozilla/5.0 (compatible; Konqueror/3.2; FreeBSD) (KHTML, like Gecko) and there was much confusion.

Gecko 很优秀,而 IE 不行,sniffing 被重新定义了,Gecko 获得了优质的网页编码,而其他浏览器则没有。
Linux 的追随者们十分悲伤,因为他们开发了 Konqueror,它的引擎是 KHTML,他们认为 KHTMLGecko 一样优秀,但事实证明它并不如 Gecko,因此没有获得优质的网页内容。于是 Konqueror 开始假装自己是“像 Gecko 一样”的浏览器,以便获得优质网页内容,使用了 Mozilla/5.0 (compatible; Konqueror/3.2; FreeBSD) (KHTML, like Gecko) 这个标识,引发了不少混乱。

Opera

img Then cometh Opera and said, “surely we should allow our users to decide which browser we should impersonate,” and so Opera created a menu item, and Opera called itself Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.51, or Mozilla/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) depending on which option the user selected.
然后,Opera 创造了一个菜单选项,允许用户决定模拟哪种浏览器。Opera 将自己称为 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.51,或者 Mozilla/5.0 (Windows NT 6.0; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 9.51,或者 Opera/9.51 (Windows NT 5.1; U; en),具体取决于用户选择了哪个选项。

Safari

img And Apple built Safari, and used KHTML, but added many features, and forked the project, and called it WebKit, but wanted pages written for KHTML, and so Safari called itself Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/85.7 (KHTML, like Gecko) Safari/85.5, and it got worse.
苹果构建了 Safari,并使用了 KHTML,但添加了许多功能,并分叉了该项目,称之为 WebKit,但希望页面仍能兼容 KHTML,因此 Safari 自称为 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/85.7 (KHTML, like Gecko) Safari/85.5,情况变得更糟。

And Microsoft feared Firefox greatly, and Internet Explorer returned, and called itself Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) and it rendered good code, but only if webmasters commanded it to do so.
当时微软非常害怕 Firefox,于是 Internet Explorer 卷土重来,并自称为 Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0),它可以渲染良好的代码,但前提是网站管理员命令它这样做。

Chrome

img And then Google built Chrome, and Chrome used Webkit, and it was like Safari, and wanted pages built for Safari, and so pretended to be Safari. And thus Chrome used WebKit, and pretended to be Safari, and WebKit pretended to be KHTML, and KHTML pretended to be Gecko, and all browsers pretended to be Mozilla, and Chrome called itself Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13, and the user agent string was a complete mess, and near useless, and everyone pretended to be everyone else, and confusion abounded.
然后谷歌开发了 Chrome,Chrome 使用了 Webkit,它与 Safari 类似,并且希望网页能够为 Safari 构建,所以假装自己是 Safari。因此 Chrome 使用了 WebKit,并假装自己是 Safari,而 WebKit 又假装是 KHTML,KHTML 又假装是 Gecko,所有浏览器都假装是 Mozilla,Chrome 自称为 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13用户代理字符串变得一团糟,几乎无用,每个人都在假装成别人,造成了极大的混乱。


访问 whatmyuseragent 验证浏览器用户代理字符串的“无间道”

环境:Windows 10

1、源于 Mozilla 的火狐浏览器 Firefox

在这里插入图片描述

2、一骑绝尘的谷歌浏览器 Chrome

在这里插入图片描述

3、紧追 Chrome 的微软浏览器 Edge( Chromium 引擎)

在这里插入图片描述


五大浏览器内核及代表浏览器

贝格前端工场于 2024-02-03 11:05:42 发布

在进行 web 前端开发的时候,浏览器兼容性一直是让所有前端工程师头疼的问题,其根源在于不同的浏览器应用了不同的内核,其对 html、css、js 的解析规则也是不一样的,作为前端开发的你,如果不知道主流浏览器的内核,怎么能行。

本文就带着大家看看五大主流浏览器的内核,此外最后有个小福利,讲讲 Chromium、Chrome、Blink 三者的关联。

img

Webkit 内核

最著名的 Webkit 内核浏览器是苹果公司的 Safari 浏览器。

  • Safari:苹果公司的官方浏览器,使用 Webkit 内核。
  • Google Chrome(早期版本):早期的 Chrome 浏览器使用了 Webkit 内核。
  • Opera(早期版本):早期的 Opera 浏览器也使用了 Webkit 内核。

Blink 内核

Blink 内核是由 Google 开发的一种浏览器引擎,它是在 Webkit 内核的基础上经过修改和优化而来。

  • Google Chrome:由 Google 开发的最流行的浏览器,使用 Blink 内核。
  • Microsoft Edge:微软开发的浏览器,最新版本使用了 Chromium 内核(也是基于 Blink 内核)。
  • Opera:最新版本的 Opera 浏览器也使用了 Chromium 内核。
  • Vivaldi:一款基于 Chromium 内核的定制化浏览器,由前 Opera 团队开发。
  • 360 极速浏览器:国内一款流行的浏览器,基于 Chromium 内核。
  • QQ 浏览器:腾讯开发的浏览器,也使用了 Chromium 内核。

Gecko 内核

Gecko 内核是由 Mozilla 基金会开发的一种浏览器引擎,它用于 Mozilla Firefox 浏览器。Gecko 内核在处理网页布局和渲染方面具有很高的性能和灵活性。

  • Mozilla Firefox:由 Mozilla 基金会开发的浏览器,使用 Gecko 内核。

Trident 内核

Trident 内核是由微软开发的一种浏览器引擎,它用于 Internet Explorer 浏览器。Trident 内核在过去的几年中已经逐渐被 EdgeHTML 内核所取代。

  • Internet Explorer:微软开发的浏览器,使用 Trident 内核。

EdgeHTML 内核

EdgeHTML 内核是由微软开发的一种浏览器引擎,它用于 Microsoft Edge 浏览器。EdgeHTML 内核是在 Trident 内核的基础上进行重写和改进而来。

  • Microsoft Edge(旧版):旧版的 Microsoft Edge 浏览器使用了 EdgeHTML 内核。

需要注意的是,这些浏览器和内核的关系可能随着时间的推移而变化,因此最好使用最新版本的浏览器和正确的内核信息。

Chromium、Chrome、Blink 三者之间的关系

Chromium、Chrome 和 Blink 是三个不同但相关的概念。

1. Chromium:Chromium 是一个开源的浏览器项目,由 Google 发起并维护。它是一个基于开放源代码的浏览器引擎,也是 Chrome 浏览器的基础。Chromium 项目的目标是提供一个稳定、快速、安全的浏览器引擎,供开发人员和其他浏览器厂商使用和修改。

2. Chrome:Chrome 是由 Google 基于 Chromium 项目构建的一个浏览器。它是基于 Chromium 引擎,并添加了一些 Google 专有的功能,如自动同步、Google 账号集成、Google Now 等。Chrome 浏览器是一个流行的、功能丰富的浏览器,被广泛用于桌面和移动设备上。

3. Blink:Blink 是一个浏览器引擎,它是由 Google 基于 Webkit 引擎进行修改和优化而来。Blink 引擎最初是作为 Chromium 项目的一部分开发的,后来被 Google Chrome 和其他浏览器采用。Blink 引擎具有高性能、快速渲染和良好的兼容性,是目前许多主流浏览器的默认引擎。

总结,Chromium 是一个开源的浏览器项目,Chrome 基于 Chromium 项目构建,而 Blink 是由 Google 开发的浏览器引擎,它是 Chromium 和 Chrome 的共同引擎。


五大跨平台桌面应用开发框架:Electron、Tauri、Flutter 等

贝格前端工场于 2024-02-27 09:46:17 发布

一、什么是跨平台桌面应用开发框架

跨平台桌面应用开发框架是一种工具或框架,它允许开发者使用一种统一的代码库或语言来创建能够在多个操作系统上运行的桌面应用程序。传统上,开发者需要为每个操作系统编写不同的代码,使用不同的开发工具和语言。而跨平台桌面应用开发框架通过抽象底层操作系统的差异,提供一套统一的 API 和工具,使开发者能够在一个代码库中编写应用程序,并将其部署到多个平台上。

img

跨平台桌面应用开发框架可以分为两种类型:

  1. 基于 Web 技术的跨平台桌面应用开发框架:这种框架使用 Web 前端技术,如 HTML、CSS 和 JavaScript 来构建桌面应用程序。它通常使用 WebView 或浏览器引擎来渲染应用程序界面,并通过桥接技术与底层操作系统进行交互。这种框架的优势是开发者可以使用熟悉的 Web 技术进行开发,并且应用程序可以在多个操作系统上运行。一些常见的基于 Web 技术的跨平台桌面应用开发框架包括 Electron、NW.js 等。

img

  1. 基于原生技术的跨平台桌面应用开发框架:这种框架使用底层操作系统的原生技术和工具来构建桌面应用程序。它通常提供了一套统一的 API 和工具,使开发者能够使用一种语言或代码库来编写应用程序,并将其部署到多个操作系统上。这种框架的优势是应用程序可以直接运行在操作系统的图形引擎上,具有更好的性能和用户体验。一些常见的基于原生技术的跨平台桌面应用开发框架包括 Qt、wxWidgets、JavaFX 等。

img

跨平台桌面应用开发框架可以提高开发效率,减少重复开发工作,并且可以让应用程序更快地部署到多个操作系统上。选择适合的跨平台桌面应用开发框架应该考虑项目需求、目标操作系统、开发经验和性能要求等因素。

二、五大跨平台桌面开发框架

  1. Electron

    Electron 是一个开源的跨平台桌面应用程序开发框架,由 GitHub 开发和维护。它基于 Chromium 和 Node.js,使用 Web 技术(HTML、CSS 和 JavaScript)来构建应用程序。Electron 可以将 Web 应用程序打包成桌面应用程序,并支持在 Windows、Mac 和 Linux 等多个平台上运行。它提供了丰富的 API 和工具,可以访问底层操作系统的功能,如文件系统、网络、窗口管理等。Electron 适用于具有复杂交互和跨平台需求的桌面应用程序。

img

  1. wxPython

    wxPython 是一个基于 Python 的跨平台图形用户界面(GUI)开发框架,它使用了 wxWidgets 库。wxPython 提供了丰富的 GUI 控件和功能,可以创建具有各种样式和布局的应用程序。它支持 Windows、Mac 和 Linux 等多个平台,并提供了与底层操作系统交互的 API。wxPython 使用 Python 语言编写,易于学习和使用,适合快速开发桌面应用程序。

img

  1. FinClip

    FinClip 是一个基于 Flutter 的跨平台应用容器,它可以将 Flutter 应用嵌入到其他应用中运行。FinClip 提供了一套丰富的 API 和功能,可以与宿主应用进行交互,如获取设备信息、调用原生功能等。它支持 Android 和 iOS 平台,并提供了一套可视化的开发工具,方便开发者进行应用的调试和测试。FinClip 适用于需要将 Flutter 应用嵌入到其他应用中的场景,如金融、电商等行业。

img

  1. Tauri

    Tauri 是一个用于构建跨平台原生应用程序的开源工具和框架。它使用 Web 技术(HTML、CSS 和 JavaScript)来构建应用程序界面,同时使用 Rust 语言来编写底层框架和与操作系统交互的代码。Tauri 可以将应用程序打包成可执行文件,并支持在 Windows、Mac 和 Linux 等多个平台上运行。它提供了丰富的 API 和工具,可以访问底层操作系统的功能,如文件系统、网络、窗口管理等。Tauri 适用于需要使用 Web 技术构建跨平台原生应用程序的场景。

img

  1. Flutter

    Flutter 是一个由 Google 开发的跨平台移动应用程序开发框架。它使用 Dart 语言编写,通过一套统一的 UI 框架可以在 Android 和 iOS 等多个平台上构建高性能、美观的应用程序。Flutter 提供了丰富的 UI 控件和功能,支持响应式编程模式,具有热重载和快速开发的特点。Flutter 的应用程序使用 Skia 引擎进行渲染,并直接运行在操作系统的图形引擎上,不依赖于 WebView 或浏览器。Flutter 适用于需要快速构建跨平台移动应用程序的场景。

img

综上所述,Electron 适用于构建跨平台桌面应用程序,wxPython 适用于基于 Python 的跨平台 GUI 开发,FinClip 适用于将 Flutter 应用嵌入到其他应用中,Tauri 适用于构建跨平台原生应用程序,Flutter 适用于构建跨平台移动应用程序。选择适合的框架应该根据项目需求、开发经验和目标平台来决定。

三、五大框架的共同点和不同点

img

共同点

  1. 跨平台性:Electron、wxPython、FinClip、Tauri 和 Flutter 都是跨平台框架,可以在多个操作系统上运行。

  2. 开发效率:这些框架都提供了一套统一的 API 和工具,使开发者能够使用一种语言或代码库来编写应用程序,并将其部署到多个平台上,从而提高开发效率。

  3. 社区支持:这些框架都有活跃的开发者社区,提供了丰富的文档、示例和插件,可以帮助开发者解决问题和加速开发过程。

不同点

  1. 技术栈
  • Electron 是基于 Web 技术的跨平台桌面应用开发框架,使用 HTML、CSS 和 JavaScript 来构建应用程序;
  • wxPython 是基于 Python 的跨平台桌面应用开发框架,使用 Python 语言和 wxWidgets 库来构建应用程序;
  • FinClip 是一个基于微信小程序的跨平台桌面应用开发框架,使用小程序开发技术来构建应用程序;
  • Tauri 是一个基于 Web 技术的跨平台桌面应用开发框架,使用 Rust 语言和 WebView 来构建应用程序;
  • Flutter 是一个基于 Dart 语言的跨平台桌面应用开发框架,使用 Flutter 框架和 Dart 语言来构建应用程序。
  1. 应用类型:这些框架适用于不同类型的应用程序开发。Electron 和 Tauri 适用于构建桌面应用程序,wxPython 适用于构建 Python 语言的桌面应用程序,FinClip 适用于构建微信小程序的桌面应用程序,Flutter 适用于构建跨平台的移动应用和桌面应用程序。

  2. 性能和体验: 由于使用不同的底层技术和工具,这些框架在性能和用户体验方面可能有所不同。一些框架如 Electron 和 Flutter 具有较好的性能和用户体验,而其他框架可能受限于底层技术的性能和限制。

img

选择适合的框架应该根据项目需求、目标平台、开发经验和性能要求等因素进行评估和比较。


via:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值