CS 100 (Learn) — CS 100 (Web) — Module 09
Before we explore the dynamic web in detail, we will first introduce some new terminology to describe the different roles that computers and web pages have on the internet.
In a previous module, we described DNS Servers, which are computers that respond to requests for address lookups.
For example, when a computer sends a DNS Server the name www.student.cs.uwaterloo.ca, it looks it up in a database and returns the address 129.97.167.19.
There are many different types of servers on the internet, the most common being a web server. However, we haven't really discussed exactly what a web server does.
Earlier, we learned how you can host your own web page on your account.
If you upload an HTML file named hello.html to your course account correctly, you will be able to view your file by visiting it at your web page: https://www.student.cs.uwaterloo.ca/~YOURUSERNAME/hello.html.
In this case, the web server is a computer with the name www.student.cs.uwaterloo.ca with the address 129.97.167.19.
This computer is running software that simply waits for an incoming HTTP (or HTTPS) request.
In this example, the web server receives an HTTP request for the reference ~YOURUSERNAME/hello.html.
When a web server receives a request it decides what to do.
For this example, the server is configured to recognize that the request is for a file from a specific user, so it looks in the public_html folder of that user to find the hello.html file. The web server answers the request by sending the contents of the hello.html file back to the client that made the request.
Web servers can do more than simply retrieve files and send them to clients (which we will discuss soon).
Typically, the client is a web browser running on a different computer than the web server. You are most likely viewing this page in a web browser, which has received this page from a web server.
The HTML provided by the server is in the same HTML language that we have already seen in this course.
For example, the web server provides the client with the HTML "the <strong>strong</strong> text".
It is the client (e.g., your web browser) that displays "the strong text".
If HTML contains references to more pages, the client will have to make additional requests, possibly to different HTTP servers.
For example, you have uploaded your web page so it can be viewed at: https://www.student.cs.uwaterloo.ca/~YOURUSERNAME/hello.html and inside of that web page you have a reference to an image: <img src="https://example.com/cat.jpg'>.
When your web browser visits the page, it has to make a new request to the web server (example.com) that hosts the image (cat.jpg).
The client waits for the new request to be fulfilled, and then displays the image on your screen.
Modern web pages often have dozens of additional references that must be requested before the web page can be properly displayed.
Another example would be if your web page references a CSS file. The client detects the reference to the CSS file in the HTML and makes an additional request for that CSS file.
Many popular web sites (e.g., a facebook news feed) can easily have
The web server's role is to:
The web client's role is to:
In computing (in general) the term static is used to describe something that does not change. The term dynamic is used to describe something that changes over time.
For web pages, the terminology is slightly different. A static web page is a web page that is not dynamic. That distinction may not seem important, but there is a subtle difference.
Consider again a hello.html file that you can upload:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hello</title>
<body>
Hello. Today is Monday!
Every day, you could edit the file:
<body>
Hello. Today is Tuesday!
It might seem that the page is dynamic because it has changed over time, but that would be incorrect. Both pages are considered static pages.
A web page is dynamic if it automatically changes its content due to its "environment". We will explore possible environments throughout this section, but to illustrate the difference, consider the following statement:
Hello. Today is DAY!
The above text should automatically change, based on the current day of the week (if you're suspicious, you can revisit this page tomorrow).
This automatic change is an example of a dynamic web page. Rest assured that nobody is editing this file to change the day of the week every day.