What does a page go through from entering a URL to loading?

First interpretation \color{#FF0000}{first interpretation} The first interpretation will generally go through the following process: 1. First, enter the URL in the browser address bar

2, the browser first check the browser cache – system cache – router cache, if there is in the cache, it will directly display the page content on the screen. If not, skip to step 3.

3, before sending HTTP requests, need Domain Name resolution (DNS)(DNS (Domain Name System, Domain Name System) is a core service of the Internet, it can map Domain names and IP addresses to each other as a distributed database, can make people more convenient access to the Internet, without remembering IP addresses.) To obtain the corresponding IP address.DNS can also be optimized for loading speed

4. The browser initiates a TCP connection to the server and establishes a TCP three-way handshake with the browser. (TCP stands for Transmission control Protocol. TCP connection is one of the Internet connection protocol sets.

5. After the handshake succeeds, the browser sends an HTTP request to the server for data packets.

6,The server processes the received requestsReturns the data to the browser

7. The browser receives an HTTP response

8, read the page content, browser rendering, parsing HTML source code

Dom tree generation, CSS style parsing, JS interactionClient and server interaction

11. Ajax queries

The specific process of Step 2 is as follows:

Browser cache: The browser keeps DNS records for some time, so it is only the first place to resolve DNS requests; Operating system cache: If this record is not included in the browser cache, the system will call the operating system to get the operating system record (saving the recent DNS query cache). Router cache: If the preceding two steps fail to obtain DNS records, continue to search the router cache. ISP cache: If all the preceding parameters fail, continue to search for the ISP.


The second explanation Color {#FF0000}{second interpretation}

Step 1: The client makes a domain name resolution request and sends the request to the local DNS server.

Step 2: When the local DNS server receives the request, it queries the local cache first. If the entry exists, the local DNS server directly returns the query result.

Step 3: If there is no record in the local cache, the local DNS server sends the request directly to the root DNS server. The root DNS server then returns to the local DNS server the address of the primary DNS server in a queried domain (a subdomain of the root).

Step 4: The local server sends a request to the DNS server that it returns in the previous step. The server that receives the request queries its cache and returns the address of the relevant subordinate DNS server if there is no such record.

Step 5: Repeat step 4 until you find the correct record.