What happens when you enter a URL into the browser
Let's look at this process step by step.
Step 1. The user enters the URL into the browser and presses Enter. The first thing we need to do is convert the URL to an IP address. The mapping is usually stored in the cache, so the browser searches for the IP address in several cache levels: browser cache, OS cache, local cache and provider cache. If the browser could not find a match in the cache, it accesses the DNS (Domain Name System) resolver to resolve it.
Step 2. If the IP address cannot be found in any of the caches, the browser accesses DNS servers to perform a recursive DNS lookup until the IP address is found.
Step 3. Now that we have the IP address of the server, the browser sends an HTTP request to it. HTTPS protocol should always be used for secure access to server resources. First, the browser establishes a TCP connection to the server using a three-way TCP handshake. Then it sends the public key to the client. The client uses the public key to encrypt the session key and sends it to the server. The server uses the private key to decrypt the session key. The client and server can now exchange encrypted data using the session key.
Step 4. The server processes the request and sends a response. For a successful response, the status code is 200. The answer consists of three parts: HTML, CSS and Javascript. The browser parses the HTML and generates a DOM tree. It also analyzes CSS and generates a CSSOM tree. It then combines the DOM tree and the CSSOM tree into a rendering tree. The browser displays the content and shows it to the user.