Understanding HTTP Protocol Basics
Understanding HTTP Protocol Basics
The Transmission Control Protocol/Internet Protocol (TCP/IP) became the standard for
computer network connections in 1982.
Rather than connecting every computer on the Internet directly to every other computer on
the Internet, normally the individual computers in an organization are connected to each
other in a local network.
Internet:
So, the Internet is actually a network of networks, rather than a network of computers.
The Internet is a global network of billions of computers and other electronic devices.
With the Internet, it's possible to access almost any information, communicate with
anyone else in the world, and do much more.
The Internet Protocol (IP) address of a machine connected to the Internet is a unique 32-bit
number.
IP addresses usually are written (and thought of) as four 8-bit numbers, separated by
periods.
The four parts are separately used by Internet-routing computers to decide where a
message must go next to get to its destination.
Although people nearly always type domain names into their browsers, the IP works just as
well.
For example, the IP for United Airlines ([Link]) is [Link]. So, if a browser is
The World Wide Web—usually called the Web for short—is a collection of
different websites you can access through the Internet.
Internet with a capital "I" refers to the entire Internet (meaning the biggest collection of
networks on the planet) .
Internet with a lowercase "i" refers to any group of networks that are connected together.
Web or Internet?
It is important to understand that the Internet and the Web is not the same thing.
The Internet is a collection of computers and other devices connected by equipment that
allows them to communicate with each other.
The Web is a collection of software and protocols that has been installed on most, if not all,
of the computers on the Internet.
Web browsers:
When two computers communicate over network, one acts as a client and the other as a
server.
The client initiates the communication, which is a request for information stored on the
server. Server then sends that information back to the client.
The server locates the document among its servable documents and sends it to the browser,
which displays it for the user.
Web servers:
Servers are slave programs. They act only when requests are made to them by browsers
running on other computers on the Internet.
Web server is a computer where the web content is stored. Basically web server is used to
host the web sites
Web pages are a collection of data, including images, text files, hyperlinks, database files etc.,
all located on some computer (also known as server space) on the Internet.
When any user requests their web browser to run any web page, the webserver places all
the data materials together into an organized web page and forwards them back to the web
browser with the help of the Internet.
A web server is a dedicated computer responsible for running websites sitting out on those
computers somewhere on the Internet.
The primary objective of any web server is to collect, process and provide web pages to the
users.
This intercommunication of a web server with a web browser is done with the help of a
protocol named HTTP (Hypertext Transfer Protocol).
These stored web pages mostly use static content, containing HTML documents, images,
style sheets, text files, etc.
Web Browser
Web Server
Web Browser is an application
program that displays a World A web server is a program or the
wide web document. It usually computer that provide services to
uses the internet service to access other programs called client.
the document.
The Web browser requests the The Web server accepts, approves,
server for the web documents and and responds to the request made
services. by the web browser for a web
The web browser acts as an document or service.
interface between the server and
the client and displays a web The web server is a software or a
document to the client. system which maintain the web
applications, generate response
The web browser sends an HTTP and accept clients data.
request and gets an HTTP
response. The web server gets HTTP
requests and sends HTTP
Web browser stores the cookies responses.
for different websites.
Web servers provide an area to
store and organize the pages of
the website
A URL (Uniform Resource Locator) is a unique identifier used to locate a resource on the
Internet.
URLs consist of multiple parts -- including a protocol and domain name -- that tell a web
browser how and where to retrieve a resource.
A colon followed by port number (optional – unless specified otherwise, “:80” is the default
when using HTTP, and “:443” is the default when using HTTPS)
It is used to indicate the location of a web resource to access the web pages.
Syntax of URL
protocol://hostname/filename
Protocol: A protocol is the standard set of rules that are used to allow electronic
devices to communicate with each other.
What is a protocol?
A Protocol is a set of rules that we use for specific purposes. In the current scenario, when
we are talking about protocols, it is about communication- the way we talk to each other.
In web, multiple protocols are used to communicate. Primarily for end users, the most
important and visible protocols are HTTP and HTTPS. Though there are many other
protocols as well, HTTP and HTTPS protocols cater to most of the population.
HTTP
HTTP provides a standard between a web browser and a web server to establish
communication.
Data such as text, images, and other multimedia files are shared on the World Wide
Web
Features of HTTP:
Connectionless protocol:
HTTP client initiates a request and waits for a response from the server.
When the server receives the request, the server processes the request and sends
back the response to the HTTP client after which the client disconnects the
connection.
The connection between client and server exist only during the current request and
response time only.
It specifies that any type of media content can be sent by HTTP as long as both the
server and the client can handle the data content.
Stateless:
HTTP is a stateless protocol as both the client and server know each other only
during the current request.
Messages
Request Message: The request message is sent by the client that consists of a request line,
headers, and sometimes a body.
Response Message: The response message is sent by the server to the client that consists of
a status line, headers, and sometimes a body.
HTTPS
It is the most common protocol for sending data between a web browser and a website.
HTTPS is the secure variant of HTTP and is used to communicate between the user’s
browser and the website, ensuring that data transfer is encrypted for added security.
Any website, especially those requiring login details, should use HTTPS. You can see a
padlock icon in the URL bar, which means the page is secure. Browsers, like Google Chrome,
treat HTTPS seriously and mark non-HTTPS websites as “Not Secure.”
In most cases, the HTTPS protocol must be used while entering bank account information.
The HTTPS protocol is mostly utilised in situations when entering login credentials is
necessary.
HTTPS employs an encryption mechanism called Secure Sockets Layer (SSL), also known as
Transport Layer Security, to enable encryption.
HTTP HTTPS
HTTP speed is faster than HTTPS. HTTPS speed is slower than HTTP.
HTTP uses port number 80 for commun HTTPs uses 443 port number for communicati
ication. on.
Frontend Development
The frontend is the part of a website or web application that users directly interact with.
It includes everything visible on the screen, such as the layout, design, and interactive
features.
The frontend is responsible for creating a smooth, attractive, and user-friendly experience.
HTML (Hypertext Markup Language): The standard language for creating the structure of
web pages. It defines elements such as headings, paragraphs, links, and images.
CSS (Cascading Style Sheets): Used for styling HTML elements. CSS controls the layout,
colors, fonts, and responsiveness of a webpage.
JavaScript: A programming language that adds interactivity to the web. JavaScript is used to
create dynamic content, such as forms, animations, and interactive maps.
Backend Development
It is responsible for handling and processing data, storing and retrieving information, and
ensuring that the frontend has the necessary data to function properly.
While users interact with the frontend, the backend works behind the scenes to handle the
business logic and data management.
Databases: Backend systems interact with databases to store and retrieve data. Popular
databases include MySQL, PostgreSQL, MongoDB, and SQLite.
Web Servers: Web servers like Apache, Nginx, and IIS are used to handle HTTP requests and
deliver content to users.
HTML5 Fundamentals
It is the standard language used to create and structure content on the web.
It defines the structure of a webpage by using a series of elements, tags, and attributes to
organize text, images, links, and other multimedia elements.
A markup language is a system that uses special codes or tags within a text document to
define its structure, content, and presentation.
It forms the building blocks of all websites and is complemented by CSS for style and
JavaScript for interactivity.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Welcome to RNSIT</h1>
</body>
</html>
output
Welcome to RNSIT
In this example:
<title>: Specifies the title of the webpage (appears in the browser tab).
Features of HTML:
It is platform-independent.
Hypertext(hypertext refers to text that contains links (hyperlinks) that allow users to
navigate between different web pages or sections within the same page) can be added to the
text.
It is a markup language.
Advantages:
Disadvantages:
HTML can only create static web pages. For dynamic web pages, other languages have to be
used.
Sl No
.
Elements Description
1 header Represents introductory content or a group of navigational links.
3 main Specifies the main content of the document (only one per page).
heading.
5 footer Footer for a section or page, typically contains metadata or links.
HTML5 Elements
<!DOCTYPE html>
<html >
<head>
</head>
<body>
<header>
<h1>My Website</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section>
<h2>Welcome</h2>
</section>
<section>
<h2>Latest News</h2>
</section>
</main>
<footer>
</footer>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<figure>
</figure>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<menu>
<li><a href="#home">Home</a></li>
<li><a href="#audio">Audio</a></li>
<li><a href="#video">Video</a></li>
</menu>
<audio controls>
</body>
</html>
HTML5 Attributes
HTML5 introduced many new attributes (some global, some element-specific) to enhance
interactivity, accessibility, and semantics.
Sl Attribute Description
No
.
1 accesskey Represents a keyboard shortcut to access an element
2 contenteditable Specifies whether or not a user is allowed to edit the content
11 itemscope Represents boolean attribute that shows the position and pres
ence of microdata on an HTML document, which is read by
a computer
12 itemtype Represents a valid URL to define a specific type of items.
<accesskey>
<html>
<body>
<nav>
</nav>
</body>
</html>
contenteditable
<!DOCTYPE html>
<html>
<head>
<title>contenteditable attribute</title>
</head>
<body>
<h2>contenteditable attribute</h2>
<p contenteditable="true">
</p>
</body>
</html>
Draggable
<dropzone>
<div dropzone="copy"></div>
<hidden>
<html>
<body>
<p>MCA DEPARTMENT</p>
</body>
</html>
<spellcheck>
<html>
<body>
<form>
<p>
<textarea spellcheck="true"></textarea>
</p>
<button type="reset">Reset</button>
</form>
</body>
</html>
itemref (attribute)
itemref provides a list of element id’s with additional properties elsewhere in the document.
The itemref attribute can only be specified on elements that have an itemscope attribute
specified.
Example
</div>
Context Menu
</div>
itemid Attribute
Attributes that are common to all elements of HTML that provide microdata in the form of a
unique, global identifier of an item.
You should use this attribute only when you are using microdata.
Microdata lets you define your own custom-tailored elements and start implanting custom-
tailored properties in your web pages.
<html>
<head>
<title>BANGALORE</title>
</head>
<body>
<dt>Name </dt>
<dt>Instructor </dt>
</body>
</html>
The HTML itemprop attribute is a global attribute, that is basically used to add a
property to an item.
<html>
<body>
<br>
<br>
<br>
</div>
</body>
</html>
The itemtype attribute specifies the URL but the URLs are not connected with any resources
rather they are used by browsers to act as the identifiers.
The HTML itemscope attribute works with item types to ensure that the HTML contained in a
block is about a particular item.
Example:
"[Link]
<span itemprop="description">
</span>
A semantic element clearly describes its meaning to both the browser and the developer.
Examples of non-semantic elements: <div> and <span> - Tells nothing about its content.
Examples of semantic elements: <img>, <table>, and <article> - Clearly defines its content.
<article>
<aside>
<details>
<figcaption>
<figure>
<footer>
<header>
<main>
<mark>
<nav>
<section>
<summary>
<time>
<article> Element
An article should make sense on its own, and it should be possible to distribute it
independently from the rest of the web site.
Example
<article>
<h2>Google Chrome</h2>
<p>Google Chrome is a web browser developed by Google, released in 2008. Chrome is the
world's most popular web browser today!</p>
</article>
<aside> Element
The <aside> element defines some content aside from the content it is placed in (like a
sidebar).
Example
<p>My family and I visited The Epcot center this summer. The weather was nice, and Epcot
was amazing! I had a great summer together with my family!</p><aside><h4>Epcot
Center</h4><p>Epcot is a theme park at Walt Disney World Resort featuring exciting
attractions, international pavilions, award-winning fireworks and seasonal special
events.</p></aside>
<details> tag
specifies additional details that the user can open and close on demand.
The <details> tag is often used to create an interactive widget that the user can open and
close.
By default, the widget is closed. When open, it expands, and displays the content within.
Example
<summary> tag
The <summary> tag defines a visible heading for the <details> element. The heading can be
clicked to view/hide the details.
Note: The <summary> element should be the first child element of the <details> element.
Example
An HTML form is used to collect user input. The user input is most often sent to a server for
processing.
The HTML <form> element is used to create an HTML form for user input:
SyntaxThe <form> element is a container for different types of input elements, such as: text
fields, checkboxes, radio buttons, submit buttons, etc.
Form elements
These are the following HTML <form> elements:
<input> It is used to get input data from the form in various types such as text, password,
email, etc. by changing its type.
<fieldset> It is used to draw a box around other form elements and group the logically
related data.
An <input> element can be displayed in many ways, depending on the type attribute.
The type attribute indicates what type of input is needed for the text box, the value should
be given as text.
For any type of input, a name has to be provided which is done using name attribute.
Every browser has a limit on the number of characters it can collect. If this limit is exceeded,
the extra characters are chopped off. To prevent this chopping, maxlength attribute can be
used.
When maxlength is used, users can enter only those many characters that is given as a value
to the attribute
Password Box
If the contents of a text box should not be displayed when they are entered by the user, a
password control can be used.
In this case, regardless of what characters are typed into the password control, only bullets
or asterisks are displayed by the browser.
Example
"DTD/[Link]" >
<html xmlns="[Link]
<head>
<title>Password Box</title>
</head>
<body>
<p>
</label>
</p>
<p>
</label>
</p>
</form>
</body>
</html>
Radio Button
Radio buttons are special type of buttons which allows the user to select only individual option.
Radio buttons are created using the input tag with the type attribute having the value radio.
When radio buttons are created, values must be provided with the help of value attribute.
All the radio buttons which are created would have same name.
If one of the radio buttons has to be selected as soon as the web page is loaded, checked
attribute
Example:
"DTD/[Link]" >
<html xmlns="[Link]
<head>
<title>Radio Button</title>
</head>
<body>
<p>
</p>
</form>
</body>
</html>
Check Box
Check box is a type of input using which multiple options can be selected.
Check box can also be created using the <input> tag with the type having the value “checkbox”.
During the creation of check box, the value should be provided using the value attribute.
All the checkbox which are created would have the same name because they are group
elements.
If one of the check box have to be selected as soon as the page is loaded, checked attribute
should be
Example:
"DTD/[Link]" >
<html xmlns="[Link]
<head>
<title>Check Box</title>
</head>
<body>
<p>
</p>
</form>
</body>
</html>
The <label> HTML element represents a caption for a form element in a user
interface.
Example:
<form>
<label>
Male
<input type="radio"
name="gender"
id="male"
value="male" />
</label>
<fieldset>
Example:
<fieldset>
<legend>Personalia:</legend>
<label for="email">Email:</label>
</fieldset>
The <datalist>
The <datalist> tag specifies a list of pre-defined options for an <input> element.
Example: [Link]
<datalist id="browsers">
<option value="Edge">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
<select> Tag:
Menu items is another type of input that can be created on the page.
Example:
"DTD/[Link]" >
<html xmlns="[Link]
</head>
<body>
<p>
</p>
<p>
</select>
</p>
</form>
</body>
</html>
Text area is a type of input using which multiple statements can be entered.
During the creation of text area, it should be mentioned how many sentences can be entered.
This is done using rows attribute.
Similarly, it should also be mentioned how many characters can be entered in a line. This is
done using cols attribute.
If the value given to rows is exceeded i.e. if users enter sentences more than specified, the scroll
bar automatically appears.
"DTD/[Link]" >
<html xmlns="[Link]
<head>
</head>
<body>
<p>
<textarea name="feedback">
</textarea>
</p>
</form>
</body>
</html>
The Reset button clears all of the controls in the form to their initial states. The Submit button
has two actions:
First, the form data is encoded and sent to the server; second, the server is requested to execute
the server resident program specified in the action attribute of the <form> tag.
The purpose of such a server-resident program is to process the form data and return some
response to the user.
Every form requires a Submit button. The Submit and Reset buttons are created with the
<input> tag.
"DTD/[Link]" >
<html xmlns="[Link]
<head>
</head>
<body>
<p>
</p>
</form>
</body>
</html>
Advanced HTML5
Canvas
Canvas has several methods for drawing paths, boxes, circles, text, and adding images.
A canvas is a rectangular area on an HTML page. By default, a canvas has no border and no
content.
Note: Always specify an id attribute (to be referred to in a script), and a width and
height attribute to define the size of the canvas.
Example
<!DOCTYPE html>
<html>
<body>
</canvas>
</body>
</html>
After creating the rectangular canvas area, you must add a JavaScript to do the drawing.
Example2: [Link]
<!DOCTYPE html>
<html>
<body>
<script>
var c = [Link]("myCanvas");
[Link](0,0);
[Link](200,100);
[Link]();
</script>
</body>
</html>
Example 3: [Link]
<html>
<body>
<script>
var c = [Link]("myCanvas");
[Link]();
[Link](95,50,40,0,2*[Link]);
[Link]();
</script>
</body>
</html>
[Link](95,50,40,0,2*[Link]):
radius 40,
starting angle 0,
Example4:
<html>
<body>
<script>
var c = [Link]("myCanvas");
[Link]("RNSIT",10,50);
</script>
</body>
</html>
SVG graphics are scalable, and do not lose any quality if they are zoomed or resized.
SVG integrates with other standards, such as CSS, DOM, XSL and JavaScript.
SVG has several methods for drawing paths, rectangles, circles, polygons, text, and much
more.
Example1:
<!DOCTYPE html>
<html>
<body>
</svg>
</body>
</html>
cx="50“: The x-coordinate of the circle’s center is 50 pixels from the left of the SVG.
cy="50“: The y-coordinate of the circle’s center is 50 pixels from the top of the SVG.
Example2:
<!DOCTYPE html>
<html>
<body>
</svg>
</body>
</html>
Example3:
<!DOCTYPE html>
<html>
<body>
</svg>
</body>
</html>
Example4:
<!DOCTYPE html>
<html>
<body>
</svg>
</body>
</html>
Example3:
<!DOCTYPE html>
<html>
<body>
style="fill:lime;stroke:purple;stroke-width:5;fill-rule:evenodd;" />
</svg>
</body>
</html>
"Vector based" refers to a type of computer graphics where images are created using
mathematical equations and geometric shapes (points, lines, curves) rather than pixels
HTML5 APIs
1. Geolocation API
Since this can compromise privacy, the location is not available unless the user approves it.
The Geolocation API is accessed via a call to [Link]. This will cause the
browser to ask the user for permission to access their location data.
If the user accept, the browser will search for the best available functionality on the device
to access this information (for example GPS).
Example
<!DOCTYPE html>
<html>
<body>
<h1>HTML Geolocation</h1>
<p id="demo"></p>
<script>
const x = [Link]("demo");
function getLocation()
if ([Link])
[Link](success, error);
else
function success(position)
function error()
</script>
</body>
</html>
2. Web Storage
With web storage, applications can store data locally within the user's browser.
Before HTML5, application data had to be stored in cookies, included in every server
request.
Web storage is more secure, and large amounts of data can be stored locally, without
affecting website performance.
Unlike cookies, the storage limit is far larger (at least 5MB) and information is never
transferred to the server.
Web storage is per origin (per domain and protocol). All pages, from one origin, can store
and access the same data.
Web storage provides two objects for storing data in the browser:
[Link] - stores data with no expiration date (data is not lost when the
browser tab is closed)
[Link] stores data for one session (data is lost when the browser tab is
closed)
Example
<!DOCTYPE html>
<html>
<body>
<div id="result"></div>
<script>
const x = [Link]("result");
else
</script>
</body>
</html>
const x = [Link]("result");
This line gets the HTML element with the ID result and stores it in the variable x.
This line checks whether the Storage object is defined in the browser.
If it's not undefined then the browser does support Web Storage (like localStorage or
sessionStorage).
If Web Storage is supported, this message will be displayed inside the HTML element with
ID result.
The data will not be lost when the browser is closed, and will be available the next day,
week, or year.
Example
<!DOCTYPE html>
<html>
<body>
<div id="result"></div>
<script>
const x = [Link]("result");
[Link]("bgcolor", "yellow");
[Link] = [Link]("lastname");
[Link] = [Link]("bgcolor");
} else {
</script>
sessionStorage object is equal to the localStorage object, except that it stores the data for
only one session.
The data is deleted when the user closes the specific browser tab.
Example
<!DOCTYPE html>
<html>
<head>
<script>
function clickCounter() {
const x = [Link]("result");
if ([Link]) {
[Link] = Number([Link])+1;
} else {
[Link] = 1;
[Link] = "You have clicked the button " + [Link] + " time(s) in
this session!";
} else {
</script>
</head>
<body>
<h1>sessionStorage</h1>
<p id="result"></p>
<p>Close the browser tab (or window), and try again, and the counter is reset.</p>
</body>
</html>
---------------
Output
A web worker is an external JavaScript file that runs in the background, without affecting
the performance of the page.
When executing scripts in an HTML page, the page becomes unresponsive until the script is
finished.
A web worker is an external JavaScript file that runs in the background, independently of
other scripts, without affecting the performance of the page. You can continue to do
whatever you want: clicking, selecting things, etc., while the web worker runs in the
background.
Web workers are useful for heavy code that can't be run on the main thread, without
causing long tasks that make the page unresponsive.
Example1:
<!DOCTYPE html>
<html>
<body>
<div id="result"></div>
<script>
const x = [Link]("result");
} else {
</script>
</body>
</html>
What is AppCache?
AppCache (Application Cache) was a feature introduced in HTML5 that allowed web
applications to cache resources (HTML, CSS, JS, images) for offline use.
When implemented, a browser could serve a cached version of a site even when the user
was offline.
[Link] file([Link])
AppCache does not work from the file:// protocol. You must serve the files over http:// or
https://
[Link]
<!DOCTYPE html>
<html manifest="[Link]">
<head>
<title>Offline App</title>
</head>
<body>
<script src="[Link]"></script>
</body>
</html>
[Link]
[Link]("App is running!");
[Link] (plaintext)
CACHE MANIFEST
# version 1.0
CACHE:
[Link]
[Link]
NETWORK:
CACHE MANIFEST
# version 1.0
CACHE:
[Link]
[Link]
NETWORK:
*
NETWORK: defines resources that must come from the network (use * to allow all).
You must change something in the file (like version comment) to force updates.