The Web

Jakob Jenkov
Last update: 2014-06-15

To understand how HTML works, it can be useful to know a bit about how the World Wide Web (WWW) works. In daily speech we just refer to it as "the web". This text takes a closer look at how the web works.

Web Basics

When browsing the web you use a program called a "browser". The most popular browsers are Internet Explorer, Firefox and Chrome, which are all free.

Whenever you read a page on the web, that web page is located on a web server somewhere on the internet. You don't know exactly where the web server is physically located, but you don't need to know either. All you need to know is the address of the website you want to visit. You type the address of the website into the browsers address bar and press enter, then the browser contacts the web server, and fetches the HTML document.

Here is a diagram illustrating a browser contacting a web server over the internet:

A browser contacting a web server over the internet.
A browser contacting a web server over the internet.

The computer running the browser is also referred to as a "client" or "web client". A client of the server, that is. Sometimes the web browser itself is also referred to as a web client.

A web server can host more than just HTML documents. It can also host graphic files, Flash files, data files etc. In fact, any file that you can store on a computer, can also be made available on a website.

A web server can also generate a file dynamically, as response to a browser request. For instance, the web server may look in a database, find a list of records and return them in a dynamically generated comma separated file (.csv) which can be opened in Excel.

HTTP

HTTP is the protocol which the browser and web servers communicate by. HTTP is short for Hyper Text Transfer Protocol. HTTP is a textual protocol, meaning the requests and responses are sent in ascii text between client and server. It is also possible to send binary data via HTTP.

The web browser (client) initiates the communication by opening a TCP/IP connection to the web server, and sending an HTTP request via the open connection. The web server responds by sending an HTTP response back.

HTTP is an extensive protocol. Getting into more detail about HTTP is outside the scope of this text.

IP Addresses and Domain Names

Each computer on the internet needs an IP address in order to communicate with other computers on the internet. The IP address is used to route the data from one computer to another. An IP address is a longer number, and can thus be a bit hard to remember. Here is an example IPv4 address:

78.46.84.171

Since IP addresses are hard to remember, the domain name system was invented. The domain name system maps a domain name to an IP address. For instance, the domain name jenkov.com is mapped to the above IP address.

Examples of domain names are:

jenkov.com
www.jenkov.com

yahoo.com
www.yahoo.com

google.com
www.google.com

The domain names jenkov.com and www.jenkov.com are actually two different domain names, but they can be made to point to the same IP address. The same is true for any other domain name with and without www in front.

Domain names are registered in a domain name server (DNS). Before contacting the web server behind the given domain name, the browser contacts a DNS which returns the IP address for the domain name. The browser can then contact the web server using the web servers IP address.

A browser contacting a DNS and then a web server.
A browser contacting a DNS and then a web server.

Web Servers and Web Hotels

A web server can host more than one website. When an HTTP request is received by the web server, it looks at the domain name of the website which the request is targeting. Using the domain name it selects what website to send the request to.

A web server hosting multiple websites.
A web server hosting multiple websites.

Web Hotels

A web hotel is a web server where you can rent some disk space and host your website on. Thus you don't need to buy and operate a full server. You just rent a small part of a server. This is much cheaper.

A web hotel can be a good solution in the beginning for a website, before you know how successful the website will be.

Jakob Jenkov

Featured Videos

Java Generics

Java ForkJoinPool

P2P Networks Introduction



















Close TOC
All Tutorial Trails
All Trails
Table of contents (TOC) for this tutorial trail
Trail TOC
Table of contents (TOC) for this tutorial
Page TOC
Previous tutorial in this tutorial trail
Previous
Next tutorial in this tutorial trail
Next