What happens when you type google.com in your browser?
When one types google.com and presses enter, the browser takes several steps, which can be as follows:
. Resolves the IP address of the URL via DNS
. Generate an HTTP request with headers (user-agent, cookie, accept)
. Open an HTTP connection to the resolved IP address
. Send the request to the server
. Receive the response from the server
. Parse response headers
. Perform additional operations depending on the response header
. Decompress the response body if it's compressed
. Parse the HTML code inside the response body
. Resolves any additional resources (Scripts, Images, etc)
. Start loading those resources via their URLs using the same steps
. Render the HTML as soon as the required resources are loaded, and continue loading the remaining resources in the background.
Your browser sends a request to resolve the domain name "google.com" into an IP address. This request is sent to a Domain Name System (DNS) server.
The DNS server responds with the IP address of the server hosting "google.com."
TCP Connection:
Your browser establishes a Transmission Control Protocol (TCP) connection with the server at the IP address provided by the DNS.
This involves a three-way handshake process: the client (your browser) sends a SYN packet to the server, the server responds with a SYN-ACK packet, and finally, the client sends an ACK packet to establish the connection.
HTTP/HTTPS Request:
Your browser sends an HTTP or HTTPS request to the server. If the request is HTTPS, a secure SSL/TLS handshake occurs to encrypt the communication.
This request typically asks for the default webpage (often "index.html") hosted at "google.com."
Server Processing:
The server processes the request and prepares the response, usually in the form of an HTML document. It may also include other resources like CSS files, JavaScript, images, etc.
Response Sent to Browser:
The server sends the HTML document and other requested resources back to your browser.
Rendering the Webpage:
Your browser receives the HTML document and begins parsing it.
As it parses the HTML, the browser makes additional requests for any external resources (like images, stylesheets, and scripts) needed to fully render the page.
The browser renders the webpage, displaying the Google homepage on your screen.
Interaction:
Once the page is rendered, you can interact with it, perform searches, or click on links, triggering new HTTP/HTTPS requests.
What happens when you type google.com in your browser?
When one types google.com and presses enter, the browser takes several steps, which can be as follows: . Resolves the IP address of the URL via DNS . Generate an HTTP request with headers (user-agent, cookie, accept) . Open an HTTP connection to the resolved IP address . Send the request to the server . Receive the response from the server . Parse response headers . Perform additional operations depending on the response header . Decompress the response body if it's compressed . Parse the HTML code inside the response body . Resolves any additional resources (Scripts, Images, etc) . Start loading those resources via their URLs using the same steps . Render the HTML as soon as the required resources are loaded, and continue loading the remaining resources in the background.