What happens when you type a URL into a browser?29 Aug 2013
Ever wondered what goes on between the point where you hit enter in a browser's address bar, and see stuff appear on the page? Quite a lot, it turns out.
I was asked to learn this as part of my pre-course work for the upcoming WDI program at General Assembly. One of the things I discovered during my search for the answer is that there's a huge amount written on every tiny stage of the process, but I don't need to go into that much detail for now. This post is just a brief overview for the purpose of cementing my knowledge.
So firstly, the browser will check whether the requested object is already in its cache. If so, all it has to do is decode and render it.
If not, it'll map to an IP address via a process called a DNS lookup.
Once it has the IP address, it'll open a TCP connection with the web server at that IP address. It'll then send an HTTP request over that TCP connection. This gets a lot more complicated with HTTPS, which I'm not going to get into here, but I was curious and I did come across a pretty good post explaining how HTTPS works.
The web server can then begin to send its response. This might be HTML files, images, sound clips… whatever's supposed to be on the page.
When the browser receives this response, it'll first check to see if it's cacheable. If so, it'll store it in the cache. Then it'll decode it, and the browser's rendering engine will parse it and display it for you to see.