How the web works – what actually happens when you visit a website?
(A Beginner’s Guide)
Ever wondered what your computer actually does when you visit a website? Sometimes the time taken between hitting ‘Enter’ and seeing a site can be timed in milliseconds – but if you stop to analyse what’s going on you’ll be surprised at how much has happened.
Step 1 – The Address
Let’s say you want to visit a website – e.g. the Phosys demo site ‘Showcase Photography’, where we’ve created a selection of the features that we offer with Phosys Professional websites.
The full address for Showcase Photography is http://www.showcasephotography.co.uk. First let’s look at the address:
- ‘Protocol’ means the type of information you’re requesting. In this case, it’s ‘Hyper Text’, which is an old-fashioned way of saying ‘web site’. Other protocols include ‘ftp’, which is ‘file transfer’ (i.e. uploading and downloading).
- The prefix ‘www’ stands for ‘World Wide Web’. Your browser is clever enough not to need this as most sites are set up to work without it. (If yours doesn’t work then you should speak to your website designer!)
- The ‘Domain Name’ is simply your address – a signpost that points to your site.
- The ‘Top Level Domain’ is usually used to identify where you are, and/or what sort of site you have – ‘.com’ = commercial, ‘.gov’ = governmental, ‘.co.uk’ = UK commercial, ‘.fr’ = France, etc.
Step 2 – Your Browser
To visit any website you will need to type the address into your internet browser. Note that, as mentioned above, nowadays you don’t really need to put the ‘http://www’ bit at the front of the address. Most browsers are clever enough to fill this in for you.
(The browser is your window on the internet – the software you use to browse websites – check out our blog post on Internet Browsers here: What’s A Browser? – An Overview.)
When you’ve typed in your website address and pressed enter – your browser tells your computer that you’d like to use the internet, and your computer connects to the web using your Internet Service Provider (e.g. BT, Virgin, SKY, TalkTalk etc).
Step 3 – Your Internet Provider
Your website request is sent to a server that manages something called the ‘Domain Name System’ (DNS) – a great long list of web addresses and where they point to. This server will look through its list of addresses to see if your requested site is archived there. If it is, then it will send the details straight back and the page will begin to load.
However if the address is not in the list (a distinct possibility), then the DNS will need to consult with a higher authority…
Step 4 – The Root, the TLD and the Registrar
The DNS will look at the ‘Top Level Domain’ for your address – in our example, www.showcasephotography.co.uk, this is ‘.co.uk’.
The DNS then contacts the ‘Root Servers’ – computers listing the details for all the Top Level Domains. The Root tells the DNS where it can find the details for ‘.co.uk’ domains.
The DNS then sends your request to the computers managed by the company in charge of all ‘.uk’ domains – Nominet – who list the details of all the domains using ‘.uk’.
Nominet sends back the information for www.showcasephotography.co.uk – which tells the DNS that the domain is registered with a company called ‘123-Reg’.
The DNS contacts 123-Reg, who tell the DNS where the site is hosted. The response looks like this:
Step 5 – Loading the website
Now that you’re connected, the host of the site and your browser will communicate to figure out what information you need.
Usually this means the host will send the HTML files that make up the website’s layout. In the HTML there might be references to other files (like images, style sheets etc); when the browser sees this it will send a request to the host for these other files as well.
As this happens, the browser reads the HTML code and starts to interpret it into a website – e.g. when the code gives the page title, the browser shows the title at the top of the screen.
Some sites use ‘style sheets’, which tell the browser how bits of HTML should be displayed. E.g. the style sheet will tell the browser that all the text should be 12 pixels high, and that all headings should be in bold. So as it goes along the browser reads and interprets this information too.
The last items to load will be pictures and videos, because these are (usually) the biggest files. Once all the content has loaded, the connection to the host is terminated. The progress bar will move all the way to the end, and your site has arrived.
Time taken? Usually a second or two.
Distance travelled? It varies – but (potentially) it could be thousands of miles.