How browsers work----Introduction

原文:http://taligarsiel.com/Projects/howbrowserswork1.htm


Web browsers are probably the most widely used software. In this book I will explain how they work behind the scenes. We will see what happens when you type 'google.com' in the address bar until you see the Google page on the browser screen.

浏览器也许是使用得最广泛的软件,在这本书里,我会解析一下它背后的工作原理。我们会看到从你在地址栏输入“google.com”到浏览器显示google网页这当中发生了什么。

The browsers we will talk about

我们要谈论的浏览器

There are five major browsers used today - Internet Explorer, Firefox, Safari, Chrome and Opera. 
I will give examples from the open source browsers - Firefox,Chrome and Safari, which is partly open source. 
According to the W3C browser statistics, currently(October 2009), the usage share of Firefox, Safari and Chrome together is nearly 60%. 
So nowdays open source browsers are a substantial part of the browser business.


今天有五种主要的浏览器:Internet Explorer, Firefox, Safari, Chrome and Opera. 我举的例子基于开源浏览器----根据统计,它们的使用率接近60%


The browser's main functionality

浏览器的主要功能

The browser main functionality is to present the web resource you choose, by requesting it from the server and displaying it on the browser window. The resource format is usually HTML but also PDF, image and more. The location of the resource is specified by the user using a URI (Uniform resource Identifier). More on that in the network chapter.


浏览器的主要功能是为你展现web资源,浏览器从服务器上请求资源显示在界面上。资源的格式通常是HTML但是也有PDF、图片等等。资源的地址用URI来表示。


The way the browser interprets and displays HTML files is specified in the HTML and CSS specifications. These specifications are maintained by the W3C (World Wide Web Consortium) organization, which is the standards organization for the web. 
The current version of HTML is 4 (http://www.w3.org/TR/html401/). Version 5 is in progress. The current CSS version is 2 (http://www.w3.org/TR/CSS2/) and version 3 is in progress. 
For years browsers conformed to only a part of the specifications and developed their own extensions. That caused serious compatibility issues for web authors. Today most of the browsers more or less conform to the specifications.


浏览器根据HTML和CSS标准解析和展示HTML文件。这些标准由W3C维护。多年来,浏览器仅仅实现部分标准,因此对web内容作者造成了严重的兼容性问题。

Browsers' user interface have a lot in common with each other. Among the common user interface elements are:

Address bar for inserting the URI

Back and forward buttons
Bookmarking options
A refresh and stop buttons for refreshing and stopping the loading of current documents
Home button that gets you to your home page
Strangely enough, the browser's user interface is not specified in any formal specification, it is just good practices shaped over years of experience and by browsers imitating each other. The HTML5 specification doesn't define UI elements a browser must have, but lists some common elements. Among those are the address bar, status bar and tool bar. There are, of course, features unique to a specific browser like Firefox downloads manager. 
More on that in the user interface chapter.

浏览器的UI有很多共通的部分,包括:地址栏、前后按钮、书签、刷新和停止、主页


The browser's high level structure


The browser's main components are (1.1):

The user interface - this includes the address bar, back/forward button, bookmarking menu etc. Every part of the browser display except the main window where you see the requested page.
The browser engine - the interface for querying and manipulating the rendering engine.
The rendering engine - responsible for displaying the requested content. For example if the requested content is HTML, it is responsible for parsing the HTML and CSS and displaying the parsed content on the screen.
Networking - used for network calls, like HTTP requests. It has platform independent interface and underneath implementations for each platform.
UI backend - used for drawing basic widgets like combo boxes and windows. It exposes a generic interface that is not platform specific. Underneath it uses the operating system user interface methods.
JavaScript interpreter. Used to parse and execute the JavaScript code.
Data storage. This is a persistence layer. The browser needs to save all sorts of data on the hard disk, for examples, cookies. The new HTML specification (HTML5) defines 'web database' which is a complete (although light) database in the browser.


浏览器的主要组件

1、用户界面:包括地址栏,诸如此类

2、browser engine:用于查询和处理rendering engine

3、rendering engine:负责显示请求的内容,比如解析HTML和CSS并显示到屏幕上

4、networking:网络调用,平台独立

5、UI backend:UI组件

6、js解析器:解析和执行js代码

7、数据存储:持久层,比如保存cookies。


It is important to note that Chrome, unlike most browsers, holds multiple instances of the rendering engine - one for each tab,. Each tab is a separate process.

请注意,chrome与众不同,它为每个tab维持一个rendering engine,每个tab是一个单独的进程。


I will devote a chapter for each of these components.


Communication between the components

Both Firefox and Chrome developed a special communication infrastructures. They will be discussed in a special chapter.

firefox和chrome都有一个特殊的通信架构。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值