The entire process of entering a URL into a browser and opening it

1. Enter the URL (jd.com) in the navigation bar

2. Domain name resolution

Domain name resolution is the process of converting a domain name to an IP address. It is generally divided into the following steps:

  1. Browser cache, the browser will cache DNS (Domain Name System, Domain Name System) for a period of time
  2. System cache, check whether there is a corresponding domain name and IP from the local host
  3. The router also caches domain name information
  4. ISP (Internet Service Provider) DNS cache, go to the Internet service provider's DNS to find the cache. The ISP's DNS cache time is generally 1 hour. If there is an hour between the two times, he will go to the DNS of the domain name to retrieve the data. What we are talking about here is the comparison between the latest and the current time. That is to say, if the time gap is large, go to the DNS server of the domain name again.
  5. If the domain name information cannot be found according to the above information, the IP corresponding to the domain name will be searched from the root server of the domain name.

3. Network transmission communication

three handshakes

After getting the server IP, you must first establish a connection to communicate. The first is a three-way handshake. The purpose of the three-way handshake is "to prevent invalid messages from being suddenly transmitted to the server and causing errors."

Client: Are you there? I want to play with you.
Server: Yes, welcome
. Client: Okay, I’ll be there soon.

After the three-way handshake is completed, the client and server establish a stable virtual channel. The client can package an http request and send it to the server through the tcp protocol.

Server returns

Server analysis is based on Linux or Windows. The web sever application is installed in the system. The web sever is also called a web server and specializes in online information browsing services.
The web server receives the request, parses and processes it according to the http protocol, and returns the response information HTML document or other results.
There are web servers such as Apach, nigx, Node, etc.

Client gets data

wave four times

With four waves of hands, the alias connection terminates the agreement, and its nature is to terminate the agreement.
After the communication is completed, the TCP link is removed by waving four times, which can be initiated by both the client and the server.

4. Page construction stage

The goal of page construction is to build the UI of the web application. Page construction is mainly divided into two stages.

  1. Parse HTML code and build a document object model
  2. Execute JavaScript code

When the browser parses the DOM, it executes it from top to bottom and adopts a deep traversal strategy. When encountering external css files or images, they will be loaded asynchronously and will not affect HTML loading.

Reflow means that both the DOM node and the style have been loaded. Because the new style is downloaded or the script is executed, a new style is generated. This process is called reflow. The newly generated styles are rewritten and updated to the page, a process called redrawing. In other words, reflow will inevitably lead to redrawing.

When the browser encounters a script node during the page construction phase, it stops executing the DOM construction of HTML and starts executing JavaScript code.

5. Summary

When I first conceived it, I felt that there was nothing much. The more I wrote, the more I wrote. There are still many areas that need to be improved, so I will slowly add them. If you have any questions, please contact me~

Guess you like

Origin blog.csdn.net/qq_37617413/article/details/109604255