What Happens After You Type a URL? A Step‑by‑Step Animation
When you enter a URL, the browser checks multiple caches for the IP, performs recursive DNS lookup if needed, establishes a TCP connection and HTTPS handshake, sends an HTTP request, receives a 200 response, and then parses HTML, CSS, and JavaScript to build and render the page.
Step 1: URL to IP address
When a user enters a URL (e.g., www.linuxyz.cn) and presses Enter, the browser attempts to resolve the hostname to an IP address. It first checks several caches in order: browser cache, operating‑system cache, local DNS cache, and ISP cache. If none contain the mapping, the browser sends a query to a DNS resolver.
Step 2: Recursive DNS lookup
If the resolver does not have the answer, it performs a recursive DNS lookup, traversing the DNS hierarchy (root, TLD, authoritative name servers) until the authoritative server for the domain returns the IP address.
Step 3: TCP connection and TLS handshake
With the IP address, the browser establishes a TCP connection using the three‑way handshake. Immediately after, it initiates a TLS (HTTPS) handshake: the server presents its X.509 certificate containing the public key, the client encrypts a freshly generated session key with that public key, the server decrypts it with its private key, and both sides derive the symmetric session key used for encrypted application data.
Step 4: HTTP request, response, and rendering
The browser sends an HTTP request over the established TLS channel. A successful response carries status code 200 and includes HTML, CSS, and JavaScript resources. The browser parses the HTML to build the DOM tree, parses the CSS to build the CSSOM tree, merges them into a render tree, performs layout, and paints the page for the user.
Code example
点击左上方蓝色“
Linux技术迷
”,选择“
设为星标
”
第一时间看干货文章Linux Tech Enthusiast
Focused on sharing practical Linux technology content, covering Linux fundamentals, applications, tools, as well as databases, operating systems, network security, and other technical knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
