The Domain Name System (DNS) is the phonebook of the Internet. Humans access information online through domain names, like nytimes.com or espn.com. Web browsers interact through Internet Protocol (IP) addresses. DNS translates
domain names to IP addresses so browsers can load Internet resources.
What happens when you type google .com into a browser
- First up, you type the website address in the browser’s address bar.
- The browser checks its cache first. If there’s a cache miss, it must find the IP address.
- DNS lookup begins (think of it as looking up a phone number). The request goes through different DNS servers (root, TLD, and authoritative). Finally, the IP address is retrieved.
- Next, your browser initiates a TCP connection like a handshake. For example, in the case of HTTP 1.1, the client and server perform a TCP three-way handshake with SYN, SYN-ACK, and ACK messages.
- Once the handshake is successful, the browser makes an HTTP request to the server and the server responds with HTML, CSS, and JS files.
- Finally, the browser processes everything. It parses the HTML document and creates DOM and CSSOM trees.
- The browser executes the JavaScript and renders the page through various steps (tokenizer, parser, render tree, layout, and painting).
- Finally, the webpage appears on your screen.
References from: https://blog.bytebytego.com