Part 2: Domains, Hosting, and how the Web works for non-technical people
What really happens when you type a website in your browser and hit enter?
March 8, 2017
This is the 2nd part of a series in helping non-technical people understand software. You can find the first part here. This is geared for a non-technical crowd (non-technical in the sense that you know how to use technology, but don’t know how to program/make technology) — so if you are a software engineer reading this please don’t feel the need to correct every little detail.
When using the internet it’s easy to get lost in the magic of everything. Opening a browser (like Chrome or Safari), entering in a URL (www.sidekickwebstudio.com), and hitting enter brings you exactly where you want to be in a matter of seconds. Most people understand that there is a lot that goes on behind the scenes to make this possible, but feel too overwhelmed to even begin to try to understand it all. This article will help you understand what's really going on, and hopefully let you realize that grasping a high level overview of the system really isn’t as hard as you think!
The browser is what enables your computer to surf the internet. Think of the internet as a vast highway of information. It’s great that it’s there, but without a car or vehicle a highway isn’t much use. Your browser is the vehicle that lets you drive throughout the internet. The most common browsers are Chrome, Firefox, Safari, and Internet Explorer.
Much like a server at a restaurant, a computer server is there to serve the website to your browser. All a Server is is a collection of files. On your home computer you have files such as your music, pictures, word documents, excel files, etc. A server is just a computer much like your own that has a bunch of files and “serves” them to your browser. Everything you see on your screen for any website is simply a file that a server sends, and your browser receives and displays to you. These files are generally HTML files. To keep it familiar, you know that .doc files open in Microsoft Word, .xslx files open in Microsoft Excel, and .mp3 files open in iTunes. All a browser is is a platform to read/open HTML files. You can think of a server as simply a collection of HTML files.
So, when you go to www.facebook.com and hit enter what happens is:
1.) Your browser connects to Facebook’s server and says “Hi, I’m looking for the HTML file that will show me facebook.com"
2.) Facebook’s server says “sure one moment” and searches for the correct file.
3.) Facebook’s server finds the file, sends it to your browser, and at that point you will see facebook.com as you know it!
Since websites can have many different pages, that’s why servers have many different HTML files. For example, www.cnn.com. That will show you CNN's home page. However if you click around you will see different pages such as www.cnn.com/world , www.cnn.com/health , www.cnn.com/specials/living/cnn-parents , etc. Each of these pages has their own HTML file that shows that content. So when you go to cnn.com your browser says “Hi, I would like the HTML file to show me the home page”. However, when you go to cnn.com/world your browser says “I would like the HTML file that shows me the world news section”. CNN’s server will search for that specific HTML file, respond with that file, and you will see the website on your screen!
What it boils down to, is that a browser’s purpose is simply to read and display HTML files much like how Microsoft Word’s purpose is to read and display .doc files. The only difference is that Word finds the files directly on your own computer, whereas your browser finds the files over the Web on a different computer (the server). The end result is the same though, Word shows a .doc file that is saved on your computer - and the browser shows an HTML file that is saved on a server.
Domains & Hosting
A domain is simply the URL you type into your browser. For example cnn.com is a domain. Another is facebook.com. You can purchase domains from many different services. The most common are Godaddy, Google Domains, and Namecheap. All of these services rely on a separate company (ICANN) who is in charge of managing and “handing out” all the domains in the world. This ensures that once you buy a domain from any service - you own that domain and no other service can sell it.
Hosting is where the actual HTML files for your website live, as in which server in the world they are on. As an example let’s say you buy news.com from Godaddy. Whenever someone goes to news.com in their browser, Godaddy gets the request since that is where you purchased your domain from. At this point Godaddy will tell the browser “Hey the HTML files you are looking for are located (or hosted) on this server”. Now, your browser will connect to that server (like from the previous section) and the server will give your browser the HTML files you need to see the website on your screen!
For a metaphor you can think of the Web as a port for ships. You send a messenger (your browser) to the port to check out a ship called “The Titanic” (the server). The messenger goes to the port, finds the harbormaster, and asks where The Titanic is located. The harbormaster points him in the right direction, and now he can go to the ship, and report back on whatever information you wanted about The Titanic. In this example, the messenger is your browser, the harbormaster is Godaddy (or whomever you bought your domain from), and the ship is the server. Your browser (the messenger) is there on a mission to retrieve specific information (an HTML file) from a server (the ship). However, the messenger doesn’t know where the ship is. This is where Godaddy (the harbormaster) comes in. All messengers must always go check with the harbormaster first, and the harbormaster will direct the messenger (your browser) to the right location of the server. Godaddy is more or less a gatekeeper here who keeps everything tidy and organized for your domain. It lets browser know where to go when someone types in a domain and hits enter.
Because whomever you buy your domain from is simply a ‘gatekeeper’ it’s possible to buy your domain from one service and host it somewhere else. This can cause confusion for newcomers, but it’s really as simple as a gatekeeper directing the traffic of your domain. If you buy your domain from Godaddy you can also host it there. This would mean Godaddy will tell any browser “Hey! I have the HTML files right here on my server”. However, it’s also very possible to host your domain on a different service (such as Webflow). This means when someone goes to your website Godaddy will say “Hey! The HTML files you want are over at Webflow”. And Webflow will then send your browser the correct HTML files and your browser will show the website you entered.
In summary, your browser is the vehicle that lets you access the information on the Web. The Web is really just a collection of servers around the world. A server is a computer that has a bunch of files on it, and gives the correct file to the browser when you go to a website. A browser is simply there to talk to a server, get the correct HTML file, and show it on your screen. Your hosting is where the actual HTML file lives, as in which physical server in the world holds the HTML file. Where you buy your domain from serves as the gatekeeper and directs all visitors to your website to the proper location.