Vy

Software Engineer in San Francisco

Vy

What happens when I type somewebsite.com into the URL bar and press enter?

This seems to be every interviewer’s favorite question to ask. So I wanted to provide at least 2 blog posts to answer this question. This one (the first) will answer it with a high-level overview. I’ll follow up with another post that goes more into detail.

Type-type-type-enter-ping!

Tom Hanks

1) First the browser will check the IP address of the domain name that was just entered

2) When the IP address is eventually found, it will be sent back to the browser. The browser then sends the HTTP GET request. This process, may have to travel through multiple servers to get to the one that holds the data needed

3) An interesting thing that can (most likely) will happen here is that the server can respond with a permanent redirect. Caching the info for https://www.somewebsite.com and https://somewebsite.com uses more memory because they’re cached as separate entities. So the server will send a “Moved Permanently” 301 response so the browser knows which to go to

4) So the browser will follow this redirect, and another GET request is sent. Eventually, the correct server will have the info needed, and the server will process the request and send a response.

5) The browser receives the response and renders the response as it comes in, not after the response has completed its arrival

6) After the initial response is processed and starts rendering to the client, most likely, it requires more embedded objects in the initial HTML response. More GET requests are sent out for objects like images, CSS files, or JS files. These GET requests go through a similar process as above.

7) Lastly, ever notice your browser in your Activity Monitor is always running and doing something even when you’re not? It’s because most sites, like Facebook, are always sending Asynchronous AJAX requests for more information. If you’re on your NewsFeed page on Facebook, it automatically updates with new posts from your friends and organizations from around the globe every x-seconds. It’s because when logged into your account, the browser will send for requests to always GET new data to keep you up to date.

So there’s my quick and high level overview of what happens when a user enters a URL into the browser. I somehow organized it into 7 steps but obviously it’s more like 450,000 steps. But hopefully the person asking you this is going to ask you other interesting questions that better evaluate your candidacy. I think a question like this is important, but I also believe knowing other information can just as easily prove you’re a capable programmer. But this is a classic.

Resources: