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

1.背景介绍

      web浏览器或许是应用最广泛的软件了,本文将介绍浏览器背后的原理。我们将看到,从你在地址栏上输入“google.com”,到浏览器屏幕上出现google的页面,这个过程里到底发生了什么。

本文要涉及的浏览器

现在主要有5种浏览器,Internet Explorer, Firefox, Safari, Chrome 和 Opera。本文将给出一些开源浏览器的例子,

如Firefox,Chrome and Safari,它们都是部分开源的。据W3C

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.

浏览器的主要作用

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.

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.

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.

The browser's high level structure

The browser's main components are (1.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.
  2. The browser engine - the interface for querying and manipulating the rendering engine.
  3. 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.
  4. Networking - used for network calls, like HTTP requests. It has platform independent interface and underneath implementations for each platform.
  5. 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.
  6. JavaScript interpreter. Used to parse and execute the JavaScript code.
  7. 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.

How browsers workIntroduction 
Figure 1: Browser main components.

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.

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.

相关文章:

  • 2022-12-23
  • 2021-10-16
  • 2022-02-25
  • 2021-11-05
  • 2022-01-18
  • 2022-12-23
  • 2021-12-12
猜你喜欢
  • 2021-07-12
  • 2021-09-04
  • 2022-12-23
相关资源
相似解决方案