The essential functioning of almost all websites is the same, based on a series of requests and responses.
Contents
First step: The request is sent.
The process begins when your browser sends a request to the web server that hosts a web page. The most important item in that request is the URL, or Uniform Resource Locator. The URL includes:
- Everything before the first slash is the domain name, this identifies the host.
- Everything after the first slash tells the hosting server what specific resource you are looking for.
Second step: The server responds.
Next, the web hosting server responds to the request. If the request is successful, the response will include the contents of the file (resource) your browser asked for. If there is a problem with the request, or with the server, the response will be an error code.
Once the website resources have been received from the server, your browser begins processing and displaying the response. Often, the returned page (document) contains links to other resources (files) which the browser will need in order to display the page properly:
- Images, video, or other media which should appear on page
- CSS style sheets which tell the browser how to style the document
- JavaScript files which provide some on-page functionality
For each of these additional files, the browser makes an additional request, and the server responds. If the requests are successful, the server returns the needed files.
Third Step: The website is displayed.
The browser displays the original document, with the additional resources. Within most pages are hyperlinks to other documents or pages — if you click on one, the whole process starts all over again.
Frequently Asked questions
What is a URL?
A URL is a Uniform Resource Locator. Sometimes it is called a URI, or Uniform Resource Identifier.
The URL identifies a specific, unique resource — a file, document, web service, application, or other resource
Here is an example URL:
http://example.com/specific-resource-page.html
The parts are:
- Before the
://
— the protocol — this identifies that type of request is being made and what type of response is expected. Thehttp
protocol is the most common, used for web pages. - Between the
://
and the next/
— the domain name — this identifies the hosting web server - Everything after the domain name — the specific resource on the host’s server — for any given domain, there can only be one specific resource with this path
How does the computer or browser know where to find a particular domain?
- Every computer has an IP address — a uniquely identifiable number which includes information about where the computer is (what network it is a part of).
- In order to send a request to a specific server (which is just a computer), your browser has to know the IP address of the hosting computer.
- Domain names (
example.com
) are meaningless to computers — they need the IP address to talk to each other - There is a distributed directory system (called the Domain Name System, or DNS) which manages a phone-book-like listing of every domain name and its hosting IP address(es)
- When your browser needs to send a request, it may already know the IP address (because it has looked it up before). Otherwise, it begins looking up the proper IP address.
- Looking up the IP address takes a moment, so your browser will store the information so that the next time you visit that site, it won’t have to look it up again
Are there different kinds of requests?
Yes.
The most common request — the kind of request you trigger when you type a URL into a browser or click on a link on a website, is called a GET.
It is called a GET request, because (in theory) you are trying to get something — access to the document or page.
There are also other types of requests:
- POST — This is what happens when you submit a form or upload a file — you are posting your data to the server.
- EDIT — Used by some applications for editing resources in place.
- DELETE — Used by some applications for deleting resources. (Almost never used.)
Most of the time, your browsers and the sites you interact with, handle all the different types of requests, and you don’t have to worry or think about what is going on “under the hood.”