Institute: LE College, Morbi
Department: Information Technology
Subject: Web Development Semester 5
Prepared by: Prof. Rahul R. Keshwala
Introduction: Basics of WWW, HTTP protocol methods and headers, HTTP Request and Response,
Architecture of web browser, Web server installation and configuration, Web security, CORS,
Understanding SEO
Basics of WWW (World Wide Web)
1. Definition and Concept
The World Wide Web (WWW) is a system of interlinked hypertext documents and multimedia
content accessible via the Internet. It was invented by Tim Berners-Lee in 1989 and launched for
public use in 1991. Users access the web using a browser and interact with content using URLs
(Uniform Resource Locators).
Key Terms:
• Web: A service over the internet.
• Web Browser: A software to access web pages (e.g., Chrome, Firefox).
• Web Server: A system that hosts web content and responds to browser requests.
2. How WWW Works – Simple Flow
You type: www.amazon.in → Browser sends a request → Server responds → Webpage displayed
Steps in the WWW Process:
1. DNS Lookup – Browser finds the IP address from the domain name.
2. HTTP Request – Browser sends a request to the web server.
3. Server Processing – Server prepares a response.
4. HTTP Response – Server sends back the webpage.
5. Rendering – Browser displays the content.
3. Real-World Analogy: WWW as a huge library,
• Web pages are books,
• URLs are like book IDs,
• Browser is the librarian,
• Web servers are the bookshelves storing all the data.
Real-Life Analogy: Restaurant & Web
Imagine you’re at a restaurant:
• You (User) place an order with the waiter (Web Browser).
• The waiter passes your request as an order slip (HTTP Request) to the kitchen (Web Server).
• The kitchen prepares the food (Response Data) and gives it back to the waiter.
• The waiter brings it back to you (HTTP Response).
Just like that, browsers and servers communicate using the HTTP protocol to serve web
pages.
4. Components of WWW
Component Description Example
URL Unique address of a webpage https://www.google.com
Web Browser Accesses and displays content Chrome, Firefox
Web Server Hosts websites and content Apache, Nginx
Web Page A document with HTML content This page you're reading!
Hyperlink Clickable link to another page <a href="...">Click</a>
5. Real-Time Example
• Visit https://www.flipkart.com
• Open Developer Tools (F12 or right-click → Inspect)
• Go to "Network" tab
• Refresh the page
• You’ll see HTTP requests, DNS resolutions, resources like CSS/JS/images being loaded.
This is the WWW in action!
Summary / Key Points
• WWW is a system of documents accessed via the internet.
• It uses HTTP protocol and is made up of web servers, browsers, and URLs.
• Users navigate the web using hyperlinks.
• Web browsers request data, and web servers respond.
HTTP Protocol – Methods and Headers
1. What is HTTP?
HTTP (HyperText Transfer Protocol) is a standard protocol that governs the communication between
a client (usually a web browser) and a server on the World Wide Web. It allows the transfer of
resources such as HTML pages, images, videos, data, etc.
• HTTP is a stateless protocol, meaning every request is treated as a new and independent
transaction — the server does not retain any memory of previous interactions unless
sessions or cookies are used.
• It operates primarily on port 80, while HTTPS (secure version) operates on port 443.
• It is based on a request-response model — the client sends a request, and the server
responds with appropriate data and status.
2. Real-World Analogy – Restaurant Model
To simplify, imagine the web as a restaurant:
Web Concept Restaurant Analogy
Client (Browser) Customer
Server Kitchen
HTTP Waiter
Request Order slip you give to the waiter
Response Dish brought back by the waiter
Method What you're doing (viewing menu, ordering, canceling)
Status Code Restaurant’s reply (food ready, not found, etc.)
This analogy makes it easier to understand how the client (browser) and server interact using
different HTTP methods.
3. Common HTTP Methods (with Use Cases & Examples)
HTTP defines request methods, which indicate the desired action to be performed on a resource
identified by a URL.
List of Core HTTP Methods:
Method Description Real-Life Analogy Web Use Case
GET Request data from the server Asking for a menu item Loading a webpage
POST Submit new data to the server Placing a food order Submitting a contact
form
PUT Update or replace existing data Updating your order Editing user profile
DELETE Delete a resource on the Cancelling your food order Deleting a blog post
server
PATCH Modify part of a resource Asking for less spice in food Updating only email in
a user profile
HEAD Fetch only headers, not the Asking “is the dish Checking if file exists
body available?” but not
ordering
OPTIONS Ask what operations are Asking “what dishes can I Used in CORS and
allowed order?” preflight checks
TRACE Echo back the request (used Asking the waiter to repeat Debugging network
for diagnostics) your order paths
CONNECT Establish a tunnel for SSL Creating a private line to Used with HTTPS
(HTTPS) communication kitchen proxies
4. All Major HTTP Methods
1. GET
Purpose: To retrieve data from a server.
Nature: Safe, Idempotent
Characteristics:
• No data is sent in the body.
• All parameters are appended in the URL.
• Can be cached, bookmarked, and stored in browser history.
• Limited length due to URL restrictions (~2048 characters in some browsers).
Example:
GET /user/profile?id=101 HTTP/1.1
Host: www.example.com
Real-world analogy:
“You walk into a shop and ask to view a product catalogue.”
You don’t change anything — just view.
2. POST
Purpose: To submit new data to the server (create a resource).
Nature: Not safe, Not idempotent
Characteristics:
• Data is sent in the body, not URL.
• Used for form submission, login, file uploads, etc.
• Not cached or bookmarked.
• Can contain large amounts of data.
Example:
POST /submit-form HTTP/1.1
Content-Type: application/x-www-form-urlencoded
name=John&email=john@example.com
Real-world analogy:
“You fill out an order form and submit it to place a food order.”
3. PUT
Purpose: To update or replace an existing resource.
Nature: Idempotent
Characteristics:
• Sends full data for replacement.
• If resource doesn’t exist, it may be created (depends on implementation).
Example:
PUT /user/123 HTTP/1.1
Content-Type: application/json
{ "name": "John", "email": "john@example.com" }
Analogy:
“You tell the kitchen to replace your entire meal with a new one.”
4. PATCH
Purpose: To partially update a resource.
Nature: Not safe, Not idempotent (but usually treated idempotently)
Characteristics:
• Only sends the fields that need to change.
• More efficient than PUT for minor updates.
Example:
PATCH /user/123 HTTP/1.1
Content-Type: application/json
{ "email": "new@example.com" }
Analogy:
“You tell the kitchen to only add salt to your existing dish — not remake the whole.”
5. DELETE
Purpose: To remove a resource from the server.
Nature: Idempotent
Characteristics:
• May return 200 (OK), 204 (No Content), or 404 (if not found).
• Cannot be undone from client side.
Example:
DELETE /user/123 HTTP/1.1
Analogy:
“You cancel your order — the waiter removes it from the list.”
6. HEAD
Purpose: Same as GET, but returns only headers, no body.
Use: To check if a resource exists, or how large it is.
Example:
HEAD /file.zip HTTP/1.1
Analogy:
“You ask the waiter what’s on the plate without opening it.”
7. OPTIONS
Purpose: To ask the server what methods are allowed on a resource.
Use: Used by browsers for CORS (Cross-Origin Resource Sharing) preflight requests.
Example:
OPTIONS /api/data HTTP/1.1
Analogy:
“You ask the restaurant what dishes you’re allowed to order from a specific menu.”
5. HTTP Headers
HTTP headers are extra pieces of information sent along with both requests and responses. They
provide metadata such as the browser type, data format, authentication details, etc.
Request Headers (Client → Server)
Header Purpose
Host Tells the target server
User-Agent Tells what browser or device made the request
Content-Type Format of data being sent (JSON, HTML, etc.)
Authorization Login token or credentials
Response Headers (Server → Client)
Header Purpose
Set-Cookie Sets a cookie on the client
Cache-Control Tells browser how to cache
Content-Length Size of the response data
Content-Type Type of returned data (HTML, JSON, image)
6. Quick Comparison Table
Method Safe? Idempotent? Has Body? Common Use
GET Yes Yes No Data retrieval
POST No No Yes Submit form, create record
PUT No Yes Yes Replace record
PATCH No No Yes Modify part of record
DELETE No Yes Optional Delete data
HEAD Yes Yes No Test existence
OPTIONS Yes Yes No Discover allowed methods
7. Mini Practical Task
1. Open Chrome or Firefox.
2. Go to any website (e.g., https://www.flipkart.com)
3. Open Developer Tools → Network tab
4. Refresh the page
5. Click on any request and check:
o Method (GET/POST/...)
o Headers (Request + Response)
o Status Code
Summary
• HTTP defines methods that describe what action to perform on a resource.
• Methods like GET, POST, PUT, and DELETE are most commonly used.
• Headers are metadata sent along with requests and responses.
• HTTP is stateless — every request is fresh and isolated.
• Understanding these concepts is essential for working with any web application.
HTTP Request and Response
1. Introduction to HTTP Request and Response
HTTP is a request-response protocol — meaning communication happens in pairs:
• The client (browser) sends a request
• The server processes it and sends back a response
Every interaction on the web follows this basic pattern, whether you're visiting a webpage,
submitting a form, or fetching data via JavaScript.
2. Real-World Analogy: Restaurant Revisited
Web Concept Restaurant Analogy
Client Customer
HTTP Request Order Slip
Web Server Kitchen
HTTP Response Final Dish
Status Code Waiter’s reply (Food ready / Not available)
You (the user) request a dish →
The waiter (browser) notes your request →
The kitchen (server) prepares and returns it →
The waiter hands it back to you — that’s the HTTP response.
3. Structure of an HTTP Request
An HTTP Request has three main parts:
a) Request Line
GET /home.html HTTP/1.1
• Method: What action (GET, POST, etc.)
• Resource path: What file/resource to access
• Protocol version
b) Headers
Host: www.example.com
User-Agent: Mozilla/5.0
Accept: text/html
• Key-value pairs with metadata about client/browser/data format
c) Body (only for POST, PUT, etc.)
username=admin&password=1234
• Sent when client submits data (form, JSON, file)
4. Structure of an HTTP Response
An HTTP Response also has three main parts:
a) Status Line
HTTP/1.1 200 OK
• Protocol version + status code + message
b) Headers
Content-Type: text/html
Content-Length: 4578
Set-Cookie: session_id=xyz
• Describe the returned data, cookies, caching, etc.
c) Body
<html><body>Welcome, user!</body></html>
• The actual webpage content (HTML, JSON, image)
5. Common HTTP Status Codes
Code Status Meaning
200 OK Success Page/data returned correctly
201 Created Success Resource created (POST/PUT)
204 No Content Success No response body
301 Moved Permanently Redirection New URL provided
302 Found Redirection Temporary redirect
400 Bad Request Client Error Invalid syntax or data
401 Unauthorized Client Error Needs login/token
403 Forbidden Client Error Access denied
404 Not Found Client Error Page/file not found
500 Internal Server Error Server Error Code crash, misconfiguration
503 Service Unavailable Server Error Server down or busy
6. Complete Example
HTTP Request:
POST /login HTTP/1.1
Host: www.example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 32
username=admin&password=123
HTTP Response:
HTTP/1.1 200 OK
Content-Type: text/html
Set-Cookie: sessionid=xyz123;
<html><body>Welcome!</body></html>
7. Practical Activity (Browser DevTools)
1. Open Chrome → Right-click → Inspect → Network Tab
2. Visit any website
3. Click a request
4. View:
o Request URL
o Request Method
o Status Code
o Response Headers
o Preview (body)
This real-time inspection helps you understand the request-response structure better than theory
alone.
GET vs POST – Full Comparison
GET POST
Used to retrieve data from the server. Used to submit data to the server.
Data is sent via the URL as query parameters. Data is sent in the request body.
Data is visible in the URL and browser history. Data is hidden from the URL and not saved in
browser history.
Can be cached and bookmarked. Cannot be cached or bookmarked.
Safer for read-only operations (like search). Safer for write operations (like login or file
upload).
Limited data size (due to URL length Can send large amounts of data.
restrictions).
Safe and idempotent (no changes even if Not idempotent (can cause duplicate actions if
called repeatedly). called repeatedly).
Suitable for loading pages, filters, or search Suitable for submitting forms, login, or
results. registration data.
Can be repeated without side effects. Repeating may re-submit data or trigger
duplicate operations.
Summary
• HTTP Requests initiate communication from browser to server.
• Each request contains: Request line, Headers, and optional Body.
• Server responds with: Status line, Headers, and Response body.
• Status codes indicate the result — whether successful, redirected, or failed.
• Tools like Chrome DevTools help visualize the entire lifecycle.
Rule of Thumb:
• Use GET when requesting data that does not change anything on the server.
• Use POST when you want to send new data or perform an action that changes state (like
form submission or registration).
Architecture of Web Browser
1. What is a Web Browser?
A web browser is an application software that retrieves, interprets, and displays web content (HTML,
CSS, JS) from web servers. It acts as a client in the client-server model and uses protocols like
HTTP/HTTPS to fetch data.
Popular browsers include Google Chrome, Mozilla Firefox, Safari, Edge, and Opera.
2. Real-World Analogy
Think of a web browser like a movie theatre:
Web Browser Component Movie Theatre Analogy
User Viewer
Address Bar Ticket window (you request the film by name/URL)
Network Layer Film delivery system (gets the movie from a studio)
HTML Parser Script translator (turns the film script into scenes)
CSS Engine Costume designer (styles how things look)
JS Engine Actor/director (adds interactivity)
Render Engine Projector (renders scenes onto screen)
Screen Browser Window (final output seen by user)
3. Core Components of a Web Browser
a) User Interface (UI)
• Everything the user interacts with: address bar, back/forward buttons, bookmarks, etc.
• Not involved in rendering but important for interaction.
b) Browser Engine
• Acts as a bridge between UI and the rendering engine.
• Handles communication, actions, and rendering instructions.
c) Rendering Engine
• Parses HTML and CSS and paints the page on the screen.
• Example engines:
o Blink (used in Chrome, Edge, Opera)
o Gecko (used in Firefox)
o WebKit (used in Safari)
d) Networking Module
• Responsible for network calls using HTTP/HTTPS, and managing connections, cookies, cache.
• Uses underlying OS libraries (like sockets, DNS lookup).
e) HTML Parser / DOM Tree Builder
• Converts HTML content into a DOM Tree (Document Object Model).
• DOM is a structured representation of the page used by JS and the browser.
f) CSS Parser / Style System
• Parses CSS files and inline styles.
• Combines with DOM to create Render Tree for layout and painting.
g) JavaScript Engine
• Executes JavaScript to make the page dynamic and interactive.
• Examples:
o V8 – Google Chrome
o SpiderMonkey – Firefox
o JavaScriptCore – Safari
h) Layout and Painting Module
• Layout: Calculates position and size of each element.
• Painting: Draws pixels on the screen.
• Compositing: Final composition of all elements.
i) Data Storage
• Handles cookies, localStorage, sessionStorage, IndexedDB, and cache.
• Allows offline and persistent experiences.
4. Rendering Flow (Simplified Steps)
1. User enters URL
2. DNS Lookup + HTTP Request
3. HTML file received
4. HTML parsed → DOM Tree built
5. CSS parsed → Style Rules applied
6. Render Tree created
7. Layout: positions calculated
8. Paint: pixels drawn
9. Composite: final page shown
5. Mini Practical Task (Chrome DevTools)
1. Open a website → Press F12 → Performance tab
2. Refresh the page → Click Record
3. You'll see the timeline of:
o DOM Building
o Style Calculation
o Layout & Paint
o JavaScript execution
Summary
• A web browser is a complex software system responsible for fetching, interpreting, and
displaying web content.
• Major components include: UI, Browser Engine, Rendering Engine, JS Engine, Network
Layer, DOM Parser, CSS Engine, Layout & Painting module.
• Understanding browser architecture helps optimize website performance and debugging.
Web Server Installation and Configuration
1. What is a Web Server?
A web server is both:
• Hardware: A machine that stores and delivers web content over the Internet.
• Software: An application (like Apache, Nginx, or Node.js) that handles HTTP requests and
sends responses to clients (browsers).
The server hosts website files (HTML, CSS, JS, PHP, etc.) and serves them when users access the
website through a browser.
2. How a Web Server Works (Simplified Flow)
1. Client enters a URL in the browser.
2. DNS resolves it to the server’s IP address.
3. Browser sends an HTTP request to the server.
4. Server processes the request, fetches the correct file.
5. Sends back an HTTP response (HTML file, image, etc.)
6. Browser renders it on screen.
3. Popular Web Server Software
Server Use Case Supported Tech
Apache HTTP Server Most common; easy setup HTML, PHP
Nginx High performance, scalable Static sites, reverse proxy
XAMPP/WAMP Local development Apache + MySQL + PHP
Node.js with Express Dynamic JS apps JavaScript (server-side)
IIS (Windows) Microsoft web stack ASP.NET
Local Web Server Setup (XAMPP Example)
XAMPP is a free, open-source local server solution for Windows/Linux/macOS.
Installation Steps:
1. Download XAMPP: https://www.apachefriends.org
2. Install and launch XAMPP Control Panel
3. Start Apache (for web server) and MySQL (if using databases)
4. Place files in:
C:\xampp\htdocs\
For example:
o C:\xampp\htdocs\mysite\index.html
5. Access site using browser:
http://localhost/mysite/
5. Basic Apache Configuration (Optional Advanced)
The Apache configuration file is:
httpd.conf
Common changes include:
• Changing port from 80 to 8080:
Listen 8080
• Setting document root:
DocumentRoot "C:/xampp/htdocs/mysite"
Restart Apache after any changes.
6. Hosting Static Files on a Server
To serve HTML/CSS/JS:
• Place files in the server root directory
• Use file extensions like .html, .css, .js
• Start the server → Access via browser
Example:
<!-- index.html -->
<html>
<head><title>My Site</title></head>
<body><h1>Welcome to my homepage</h1></body>
</html>
7. Common Issues & Fixes
Issue Fix
Port 80 already in use Change Apache port to 8080
“Site not found” File not placed correctly in htdocs
Page shows PHP code Apache not configured for PHP / PHP not installed
Firewall blocking Allow Apache in Windows Firewall
8. Mini Practical Task
1. Install XAMPP
2. Start Apache
3. Create folder htdocs/mytest
4. Create a file index.html inside with basic content
5. Open browser → http://localhost/mytest
6. (Optional) Try a PHP file:
<?php echo "Hello from PHP"; ?>
Summary
• A web server hosts and serves web content over HTTP/HTTPS.
• Software like Apache, Nginx, or XAMPP can be used for development or production.
• XAMPP is a local development tool that includes Apache, PHP, and MySQL.
• Files are served via localhost, and configuration can be customized via settings.
Web Security
1. What is Web Security?
Web security is the practice of protecting websites and web applications from unauthorized access,
data theft, damage, or misuse. It ensures the confidentiality, integrity, and availability (CIA triad) of
data on the internet.
Without proper web security, users and data are vulnerable to cyber-attacks such as hacking, data
breaches, malware injection, and more.
2. Common Web Security Threats
1. Cross-Site Scripting (XSS)
• Injecting malicious scripts into trusted websites.
• Affects users' browsers (stealing cookies, redirecting to phishing sites).
• Example: <script>alert('Hacked!')</script> injected into a comment box.
Prevention:
• Sanitize and encode user input.
• Use security headers like Content-Security-Policy.
2. SQL Injection (SQLi)
• Attacker manipulates SQL queries to access or modify database content.
• Example: Entering ' OR 1=1 -- in a login form bypasses authentication.
Prevention:
• Use prepared statements / parameterized queries.
• Never directly concatenate user input in SQL.
3. Cross-Site Request Forgery (CSRF)
• Tricks authenticated users into performing actions without consent.
• Example: A malicious link that performs a fund transfer when clicked.
Prevention:
• Use CSRF tokens.
• Validate origin and referer headers.
4. Clickjacking
• Invisible layers trick users into clicking hidden buttons or links.
• Used to steal credentials or perform unwanted actions.
Prevention:
• Use X-Frame-Options: DENY header to prevent iframe embedding.
5. Man-in-the-Middle (MITM) Attack
• Intercepts communication between user and server to steal data.
• Common in unsecured (HTTP) connections.
Prevention:
• Use HTTPS with SSL/TLS encryption.
• Avoid public Wi-Fi for sensitive transactions.
6. Brute Force Attacks
• Automated guessing of usernames/passwords.
• Often used on login forms.
Prevention:
• Implement rate limiting, account lockouts, and CAPTCHA.
3. Key Web Security Concepts & Tools
Term Explanation
HTTPS Secures communication using SSL/TLS.
Firewall Filters malicious traffic to/from the server.
Encryption Converts data into unreadable form.
Authentication Verifies user identity (login, tokens).
Authorization Checks user permissions (access control).
Input Validation Filters user input to prevent exploits.
Security Headers Instruct browser to enhance security (e.g., X-XSS-Protection)
Content Security Policy (CSP) Prevents inline scripts and unauthorized code injection
4. Real-World Examples
• Equifax Data Breach (2017): Exploited unpatched vulnerability → 147 million records stolen.
• Facebook XSS Flaws: Allowed attackers to post malicious links and steal session tokens.
• Capital One Breach: Misconfigured firewall → hacker accessed credit applications of 100
million users.
5. Mini Practical Task (Observe Browser Security)
1. Visit any HTTPS website.
2. Click lock icon → View certificate.
3. Press F12 → Console → Try entering:
document.cookie
See if cookies are HttpOnly or not (should be secure!).
Summary
• Web security is essential to protect users, data, and systems.
• Common threats include XSS, SQLi, CSRF, Clickjacking, MITM, and Brute-force attacks.
• Defenses include input validation, HTTPS, tokens, firewalls, CSP, and secure coding
practices.
• Awareness and proactive measures are key to building secure web applications.
CORS (Cross-Origin Resource Sharing)
1. What is CORS?
CORS (Cross-Origin Resource Sharing) is a security feature implemented by web browsers that
controls how resources (like APIs, images, fonts, etc.) can be requested from a different origin
(domain/protocol/port) than the one the web page was loaded from.
In simple terms, it prevents a web page from making requests to another domain unless explicitly
allowed.
What is a “Cross-Origin” Request?
A request is considered “cross-origin” when:
• The protocol, domain, or port of the requesting site differs from the resource being
requested.
Examples:
Request Origin Resource Requested Cross-Origin?
https://example.com https://example.com/data.json No
https://example.com http://example.com/data.json Yes (different protocol)
https://example.com https://api.example.com/data.json Yes (subdomain)
https://example.com https://anotherdomain.com/data.json Yes (different domain)
2. Why is CORS Needed?
Imagine a malicious site loading in a user’s browser and making hidden requests to a banking API on
behalf of the user. To prevent such attacks, browsers block these types of requests unless the target
server explicitly allows them using CORS headers.
CORS ensures that only trusted sites are allowed to access server resources.
3. How CORS Works (Behind the Scenes)
When a browser sends a cross-origin request, it does one of the following:
a) Simple Request
Used for GET, POST (with basic content types like application/x-www-form-urlencoded, text/plain,
etc.)
• Browser sends the request
• Server responds with a CORS header like:
Access-Control-Allow-Origin: https://example.com
If allowed, the browser lets the client-side JS access the response.
b) Preflight Request
Used for requests with custom headers, PUT, DELETE, or JSON data.
• Browser sends an OPTIONS request first
• Server must respond with:
Access-Control-Allow-Origin: https://example.com
Access-Control-Allow-Methods: GET, POST, PUT
Access-Control-Allow-Headers: Content-Type, Authorization
• If the response is valid, the browser sends the actual request
4. Real Example
Example: JavaScript fetching an external API
fetch("https://api.myservice.com/user", {
method: "GET",
headers: {
"Authorization": "Bearer token"
}
})
.then(response => response.json())
.then(data => console.log(data));
If https://api.myservice.com doesn’t include:
Access-Control-Allow-Origin: https://yourdomain.com
the browser will block the response.
5. Server-side CORS Configuration (Examples)
In PHP:
header("Access-Control-Allow-Origin: *"); // Allow all
In Node.js (Express):
const cors = require('cors');
app.use(cors({ origin: 'https://yourdomain.com' }));
In Apache (via .htaccess):
Header set Access-Control-Allow-Origin "*"
Note: Using * allows any domain, which is not secure for sensitive APIs.
6. CORS vs Security
CORS does not protect your server — it protects the user's browser. The server must still handle:
• Authentication
• Authorization
• Rate limiting
• Input validation
CORS is just a browser-side enforcement.
Summary
• CORS restricts cross-origin requests to prevent security risks.
• Servers must allow access using the Access-Control-Allow-Origin header.
• Simple requests go directly; complex ones require preflight checks.
• It’s a browser-side mechanism and doesn’t replace authentication.
Understanding SEO (Search Engine Optimization)
1. What is SEO?
SEO (Search Engine Optimization) is the practice of improving a website's visibility in search engine
results (like Google or Bing) so that it appears higher when users search for relevant topics.
The better your SEO, the more organic (non-paid) traffic your website can get.
2. Why is SEO Important?
• Increases website traffic without paid ads
• Improves trust and user experience
• Helps search engines understand your content
• Key for business visibility, leads, and conversions
3. How Search Engines Work
Search engines follow a three-step process to deliver relevant results for every search query:
Crawling, Indexing, and Ranking.
1. Crawling – Discovering Content
• Crawling is the first step where search engines send out automated bots known as “crawlers”
or “spiders” (e.g., Googlebot).
• These bots scan the web by following links from one page to another.
• They look for:
o New websites and web pages
o Recently updated content
o Broken or dead links
• Crawling depends heavily on internal linking and sitemaps submitted by website owners.
• Crawlers respect robots.txt files which tell them which parts of the site to avoid.
2. Indexing – Storing and Organizing Data
• After crawling, the discovered pages are analyzed and added to the search engine’s index —
a massive database of web content.
• During indexing, the engine:
o Extracts content like text, images, metadata, titles
o Understands keywords and topic relevance
o Organizes information using natural language processing (NLP)
• Not all crawled pages are indexed — pages may be skipped if they are:
o Duplicate content
o Blocked via robots.txt or noindex tag
o Low quality or slow-loading
3. Ranking – Ordering Search Results
• Once a query is entered, the search engine checks its index to return the most relevant
pages.
• Ranking is based on hundreds of factors, including:
o Keyword relevance
o Page speed
o Mobile-friendliness
o Backlinks (external links from trusted sites)
o Domain authority
o Freshness of content
• Pages are ranked from most to least relevant using algorithms like Google’s PageRank and
RankBrain.
4. Key SEO Elements for Developers
a) Meta Tags
HTML elements that help describe the page.
<title>Best Laptops 2025</title>
<meta name="description" content="Explore top laptops of 2025 with specs and pricing.">
<meta name="keywords" content="laptops, 2025, reviews">
b) URL Structure
• Keep URLs clean and readable
o /products/laptops/dell-xps-15
o /prod?id=1987&cat=elec
c) Headings and Content
• Use semantic headings (<h1>, <h2>, ...) properly.
• Include relevant keywords naturally in content.
d) Alt Text for Images
Helps both search engines and screen readers.
<img src="dell.jpg" alt="Dell XPS 15 2025 Laptop" />
e) Sitemap and Robots.txt
• Sitemap.xml: List of pages you want search engines to index.
• robots.txt: Tells crawlers which pages to skip.
5. Example HTML Page with SEO Tags
<!DOCTYPE html>
<html>
<head>
<title>Best Laptops for Developers</title>
<meta name="description" content="Top-rated laptops for programmers in 2025.">
<meta name="keywords" content="laptops, developers, coding, 2025">
</head>
<body>
<h1>Top Laptops for Developers</h1>
<p>We list the most powerful laptops for software development in 2025.</p>
</body>
</html>
6. Types of SEO
Type Description Example
On-page SEO Optimizing content & code on your site Meta tags, headings
Off-page SEO External signals Backlinks from other websites
Technical SEO Server-side, speed, mobile-friendliness Sitemap, page speed, robots.txt
7. Bad SEO Practices to Avoid (Black Hat SEO)
• Keyword stuffing
• Hidden text or links
• Buying backlinks
• Cloaking (showing different content to search engines vs users)
These can lead to penalties or removal from search engine results.
Summary
• SEO helps your site rank better in search engines and get free traffic.
• Developers can improve SEO by using proper HTML structure, meta tags, alt texts, clean
URLs, and performance optimizations.
• Avoid spammy tricks — focus on genuine, useful content and technical excellence.
Useful Full Forms:
Term Full Form
WWW World Wide Web
HTTP HyperText Transfer Protocol
URL Uniform Resource Locator
API Application Programming Interface
AJAX Asynchronous JavaScript and XML
SEO Search Engine Optimization
DOM Document Object Model
CSS Cascading Style Sheets
ISP Internet Service Provider
JSON JavaScript Object Notation
Difference-based questions:
1. GET vs POST
GET POST
Used to retrieve data from the server. Used to send or submit data to the server.
Data is sent via URL parameters. Data is sent in the body of the request.
Visible in browser history and can be Not stored in history; cannot be bookmarked.
bookmarked.
Less secure, as data is exposed in the URL. More secure, as data is hidden (especially over
HTTPS).
Has a length limit due to URL size constraints. Can handle large amounts of data (e.g., file
uploads).
Suitable for read-only operations (like search). Suitable for form submissions, registrations, etc.
Can be cached. Usually not cached by browsers.
2. HTML vs XHTML
HTML XHTML
Stands for HyperText Markup Language. Stands for eXtensible HyperText Markup Language.
More lenient in syntax rules. Requires strict syntax rules (e.g., lowercase tags,
proper nesting).
Does not require closing tags for some All elements must be properly closed.
elements.
Parsing errors are tolerated by browsers. Parsing errors cause failure in rendering.
Tags and attributes can be written in any All tags and attributes must be lowercase.
case.
Not XML-compliant. XML-based and well-formed.
3. Client-side Scripting vs Server-side Scripting
Client-side Scripting Server-side Scripting
Executed on the user’s browser. Executed on the web server.
Examples: JavaScript, HTML, CSS. Examples: PHP, Python, Node.js.
Cannot access server-side resources like Can access and manipulate databases, files, and
databases. sessions.
Reduces load on the server. Requires server resources to execute.
Visible to users (can be inspected in Hidden from users, increases security.
browser).
Faster interaction (no server call required). Slower due to network and processing delay.
4. Cookie vs Session
Cookie Session
Stored on the client-side (browser). Stored on the server-side.
Can persist even after browser is closed (based Ends when browser is closed or session
on expiry). timeout occurs.
Accessible by client (can be modified or stolen). More secure, not directly accessible by the
client.
Can store small data (~4KB). Can store larger and complex data.
Data is sent with every HTTP request. Data stays on the server; only session ID is sent.
Used for persistent login, tracking. Used for authentication, user state
management.
5. Synchronous vs Asynchronous Programming
Synchronous Programming Asynchronous Programming
Code is executed line by line, one after another. Code does not wait for previous operations
to complete.
Blocks the execution of the next instruction until the Non-blocking: other tasks can run in the
current one finishes. meantime.
Easier to read and debug. More complex due to callbacks, promises,
or async/await.
Suitable for simple operations like calculations. Ideal for I/O operations (API calls, file
read/write).
Example: alert("Hello"); console.log("World"); Example: setTimeout(() =>
console.log("Later"), 1000);
JavaScript runs synchronously by default. Asynchronous behavior is added using APIs
or events.
6. Static Website vs Dynamic Website
Static Website Dynamic Website
Content is fixed and same for every visitor. Content is generated dynamically per user/request.
Pages are created using HTML/CSS only. Pages are built using server-side scripts (e.g., PHP,
Python).
Does not interact with database. Interacts with databases for content generation.
Faster loading and easy to host. Slightly slower but interactive and personalized.
Example: Personal blog or portfolio. Example: E-commerce site, social media.
No login, search, or content management Supports features like login, form submission, CMS.
possible.
7. SEO vs SEM
SEO (Search Engine Optimization) SEM (Search Engine Marketing)
Improves website ranking organically. Uses paid ads to appear in search results.
Long-term strategy; results appear gradually. Short-term; results appear as soon as
payment starts.
Techniques include meta tags, keywords, content Techniques include Google Ads, PPC
optimization. campaigns.
No cost per click. Cost per click is charged.
Builds credibility and trust over time. Useful for quick visibility and traffic.
Examples: Improving HTML structure, backlinks. Examples: Paying to rank above
competitors.
8. HTTP vs HTTPS
HTTP (HyperText Transfer Protocol) HTTPS (HTTP Secure)
Does not encrypt data. Uses SSL/TLS encryption to secure data.
URL starts with http:// URL starts with https://
Data can be intercepted by attackers. Data is safe from interception.
Not secure for forms, logins, or payments. Secure for sensitive transactions (login, payment).
No SSL certificate needed. Requires SSL certificate from a trusted provider.
Mostly used for non-sensitive information. Used for secure websites, banking, e-commerce, etc.
Q1: What is the Role of Cache and Cookies in the Browser?
A. Browser Cache
Definition:
The cache is a temporary storage space in the browser that saves copies of web resources (HTML
files, CSS, images, JavaScript) to load pages faster on subsequent visits.
Role of Cache:
1. Improves Loading Speed: Resources are loaded from local storage instead of being re-
downloaded.
2. Reduces Server Load: Server doesn’t have to resend unchanged files.
3. Provides Offline Access: Some static content can be accessed without internet.
4. Enhances User Experience: Faster navigation across pages.
Example:
• First visit: style.css is downloaded from the server.
• Next visit: style.css is loaded from the browser cache unless changed.
Limitations:
• If not managed correctly, outdated files may be served.
• Can be cleared manually or by browser settings.
B. Cookies
Definition:
Cookies are small pieces of data stored on the client’s browser by websites to remember user-
specific information like login status, preferences, or tracking data.
Role of Cookies:
1. Session Management: Maintains login sessions (e.g., session_id=abc123)
2. Personalization: Stores user preferences like language, theme, layout.
3. Tracking: Used for analytics and targeted advertising (e.g., by Google Ads).
4. Shopping Carts: Remembers selected items in e-commerce sites.
Example:
document.cookie = "username=JohnDoe; expires=Fri, 31 Dec 2025 23:59:59 GMT";
Limitations:
• Limited to 4KB of data.
• Security risk if sensitive data is stored in plain text.
• Users can delete or block cookies.
Q2: What is Metadata? How Can We Include Metadata in HTML?
Definition:
Metadata is data about data — in HTML, it refers to information about the web page that is included
inside the <head> tag, but not displayed to the user. It's used by browsers, search engines, and social
media platforms.
How to Include Metadata:
Use the <meta> tag inside the <head> section of the HTML document:
<head>
<meta name="author" content="Dr. Arun Keshwala">
<meta name="description" content="Learn web development basics.">
</head>
Types of Meta Tags (With Examples)
Meta Tag Purpose Example
Meta Charset Declares the character <meta charset="UTF-8">
encoding of the document.
Meta Author States the author's name. <meta name="author" content="John Doe">
Meta Short summary for SEO (used <meta name="description" content="Free Web
Description by Google). Dev tutorials.">
Meta Keywords Keywords relevant to the <meta name="keywords" content="HTML, CSS,
page (less important now). JavaScript">
Meta Viewport Controls layout on mobile <meta name="viewport"
devices. content="width=device-width, initial-
scale=1.0">
Meta Robots Tells search engines how to <meta name="robots" content="noindex,
index or not index. nofollow">
Meta Refresh Auto-refreshes the page after <meta http-equiv="refresh" content="5;
time interval. url=https://example.com">
Meta Expires Sets an expiration date for <meta http-equiv="expires" content="Wed, 20
the page content. Jul 2025 20:00:00 GMT">
Meta Cache- Prevents browser from <meta http-equiv="cache-control"
Control caching the page. content="no-cache">
Meta X-UA- Ensures compatibility with IE <meta http-equiv="X-UA-Compatible"
Compatible browsers. content="IE=edge">
Key SEO Tags Summary:
<head>
<meta charset="UTF-8">
<meta name="description" content="Top laptops for developers in 2025.">
<meta name="keywords" content="laptops, developers, coding">
<meta name="author" content="Dr. Arun">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
Conclusion
• Cache stores website files locally for faster loading.
• Cookies store small bits of user-specific data for personalization and session handling.
• Metadata provides essential, behind-the-scenes information for search engines, browsers,
and accessibility tools.
• The <meta> tag in HTML is used to insert metadata and can improve SEO, accessibility, and
site behavior.
GTU Paper Questions
• What is HTTP? Explain how browser and server communicate using HTTP request and
response.
• What is HTTP? Explain HTTP Request and Response.
• Define the following:
1. URL
2. HTTP
3. Web Server
• Give full form of:
(i) WWW
(ii) HTTP
(iii) URL
• Give full name of:
1. WWW
2. CSS
3. AJAX
• Differentiate between GET and POST methods.
• Write the difference between POST and GET methods.
• Differentiate between GET and POST method.
• Explain HTTP Request and Response with header details. Also explain various HTTP status
codes.
• What is the role of cache and cookies in the browser?
• What do you mean by meta tag? How is it useful by search engine?
• Explain meta tag. Write syntax for:
o Set an expiration date
o Stop the browser from caching a page
• What is Metadata? How we can include metadata in HTML?
Practical-Based Questions
1. Use browser DevTools (F12) to inspect HTTP headers. What do you observe?
2. Install XAMPP, start Apache, and host a simple HTML file. Describe the steps.
3. Write a HTML page using proper meta tags and simulate SEO-ready content.
4. Show how to make a GET and POST request using a simple form and view the result.