How Do Web Browsers Work

Browser Categories

Modern browsers can be classified into the following six categories, based on their kernels:

Loading Sequence of a Browser

Once you enter a URL (for example, http://cloudcare.cn) in the address bar of a browser and press Enter, how does the browser load the corresponding web page?

  1. The browser sends a request to the DNS server for the address of cloudcare.cn.
  2. The DNS server returns the IP address of the server that is hosting cloudcare.cn. In this example, the IP address is 10.0.0.1.
  3. The local computer caches the DNS data and sends an access request for cloudcare.cn to the server with the IP address 10.0.0.1.
  4. The server establishes a TCP connection with the local computer to exchange data.

TCP connection and HTTP

Once the TCP connection is set up, data transfer is ready. To transfer data, the connection must meet the requirements of the HTTP protocol (with versions 1.0 and 1.1), including connection, messaging, request and response rules.

HTML Code Structure

Let us examine the structure of the HTML code. A complete HTML code consists of html, head, and body tags.

<html>
<head>
</head>
<body>
</body>
</html>

Rendering process of an HTML page

The following describes the rendering process of a browser.

  1. The web page displays the “Hello world” string.
  2. The page loads and displays images.
  3. If you have defined a style that is similar to “div {color: red;}” in the style sheet, the page will display the “Hello world” string in red once it has fully loaded the style sheet.

HTTP Cookies

Now, let us discuss cookies. Cookies are small but important pieces of data stored locally on a user’s computer. A web browser then records information such as the user’s web browsing activity on cookies. This information is useful for improving the user experience on a website but is also vulnerable to cyberattacks.

  1. They do not support cross-domain access (excluding child-level domains). For example, you cannot access any cookies under baidu.com from cloudcare.cn.
  2. Each HTTP request will automatically carry cookies in the header before being sent to the backend server.

Conclusion

In this article, we looked at some of the basic operating principles of browsers. We discussed how a browser displays results for a search query and the loading sequence involved. We also looked at the HTML code structure and briefly discussed about cookies. To gain a more in-depth knowledge about web browsers, visit http://taligarsiel.com/Projects/howbrowserswork1.htm.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

4.97K Followers

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com