What happens when you enter a URL in your browser?
+2 votes
in Technical by (725 points) | 778 views

3 Answers

+4 votes

I am assuming the user is trying to enter “www.google.com”

1. The key “g” or “w” is pressed
– Keyboard interrupt
– The keyboard sends signals on its interrupt request line (IRQ), which is mapped to an interrupt vector (integer) by the interrupt controller. The CPU uses the Interrupt Descriptor Table (IDT) to map the interrupt vectors to functions (interrupt handlers) which are supplied by the kernel. When an interrupt arrives, the CPU indexes the IDT with the interrupt vector and runs the appropriate handler. Thus, the kernel is entered. (USB keyboards slightly different)
– browser auto completes
– When you just press “g” the browser receives the event and the entire auto-complete machinery kicks into high gear. Depending on your browser’s algorithm and if you are in private/incognito mode or not various suggestions will be presented to you in the dropbox below the URL bar. Most of these algorithms prioritize results based on search history and bookmarks.
2. Then determine URL or search term? (common in
– parse URL: by finding protocol “http” and “/“ resources to identifying whether it is a URL
– if not then it takes the entered text and passes it to its default search engine to search the term
– HSTS list: if URL, then browser checks its pre-loaded HSTS list. if the site mentioned is in browsers it hsts list then sends a https request
3. once the browser has the URL it starts by looking up for an IP address, through DNS lookup in the following order:
– Browser cache
– OS cache
– router cache
– ISP cache
– if not in any of the above then the ISP’s DNS server does a recursive search starting with the root name server
4. for major websites the IP address returned is of load balancers.
5. browser opens a TCP connection to server (this step is much more complex with HTTPS)
– it takes that and the given port number from the URL (the HTTP protocol defaults to port 80, and HTTPS to port 443)
– Client sends SYN packet: Client chooses an initial sequence number (ISN) and sends the packet to the server with the SYN bit set to indicate it is setting the ISN
– Server sends SYN-ACK packet back: copies the (client ISN +1) to its ACK field and adds the ACK flag to indicate it is acknowledging receipt of the first packet
– client answers with ACK packet; establishing a 3-way TCP connection.
6. browser then sends a HTTP ‘GET’ ‘request’ to the loadbalancer over the TCP connection
7. browser receives the ‘response’ from the loadbalancer a re-direct (301 message) to the appropriate data center. and eventually closes the TCP connection.
8. browser opens a TCP with the data center.
– browser then sends ‘GET’ request to the data-center and then again a permanent re-direct from http://google.com to http://www.google.com; also some sites may even re-direct towards geo-location aka google.com to google.in or google.de etc.
9. Now finally the browser has the IP address the of the real server. It needs to send the HTTP ‘GET’ request (over the TCP connection)
10. the google.com server handles the request listening on port 80;
– if the page is cached it will be returned immediately. if not other services (like db, application servers etc.) will be called to get the page.
– the server returns a 200 OK response along with the page content.
11. The browser then starts rendering the HTML content
– as part of the content it will see all URL’s for other assets like images/SSL certificates. and sends GET request for these requests.

by (281 points)
0 votes

When you type http://www.abc.com, the browser check its cache if the website has been previously accessed. If yes, then the page is rendered from the cache, if not the browser makes a DNS request to OS. The OS sends request to the service provider for the requested DNS:
1) the request goes to the root server (which root domain has the information)
2)the request then goes to the TLD servers (which provides the exact location of the domain requested)
3)the request then goes to the name server and checks zone registry to return the IP of the requested domain.

Once the IP is retrieved. The browser established a TCP/IP connection and will start sending the data.

TCP/IP has following processes:
1) Handshake in form of client hello and server hello (high level detail of protocol and unique identifiers)
2) server send certificate
3) certificate is verified
4) The data is broken into several packets and then on top of that we add sender’s and reciever’s address, along with mac address.

–3 votes

It will ping a DNS server to get an IP address for the URL

Hi Syed
Thanks for submitting your answer.
You’ll need a far more detailed answer for this. The interviewer wants to see the depth of your knowledge.
Hope it helps.
How is this a PM question? I would have taken it in a complete different direction as I know the ads world better. When you enter a url in the browser, the site makes an ad-call to the SSP which then converts it into a bid request. The bid request is sent out to the DSP partners who then run the auction based on the metrics available in the request (user cookie, IP, demo , audience segment etc). The winning ad is then sent back to SSP in the form of bid response who then runs the auction again between all the winning ads it got from the DSPs. The ad which wins finally on the SSP side is shown to the user on the site/ url the user entered. I am failing to understand what skills this type of question is gauging?
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
To avoid this verification in future, please log in or register.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
To avoid this verification in future, please log in or register.