Web Development 1
Dr Derek Bridge
School of Computer Science & Information Technology
University College Cork
- Where in our HTML have we used URLs?
<a href="http://en.wikipedia.org/wiki/Ernest_Hemingway">Ernest Hemingway</a>
- Image elements
<img src="mojito.jpg" title="A mojito"
alt="A mojito is packed with mint leaves and served in a long glass." />
- Video and audio source elements
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4" />
- Link elements
<link rel="stylesheet" href="styles.css" />
- In general, URLs consist of eight parts:
- Most are optional; several have defaults, e.g.:
- The scheme tells your browser what action to take when, e.g., a user clicks on the link
http (the default):
- Tells browser to send out a request using HTTP
- Same as
http but HTTP request and response are encrypted
The scheme, continued
<a href="file:///C:/Users/derek/mypage.html">My page</a>
- Tells browser to load web page typically from user's local disk
- Question: Why three slashes?
- Question: Why should you never use this kind of URL in a web page?
<a href="mailto:firstname.lastname@example.org">Mail me</a>:
- Tells browser to launch an email program
- Question: Why should you be very wary of using this?
- Tells Chrome browsers to display 'internal' information
The host: IP address
- Every device that is connected to the Internet is assigned a unique IP address (Simplification!)
- The Internet is moving from IPv4 (32-bit IP addresses) to IPv6 (128-bit IP addresses)
- Enough for 340 trillion, trillion, trillion devices
- E.g. in hexadecimal 2001:0db8:85a3:0000:0000:8a2e:0370:7334
- In a URL, the host specifies the IP address of the server that will receive your request
The host: hostname
- Numeric IP addresses are cumbersome for humans
- Hence, most computers (hosts) that are connected to the Internet also have one (or more) names (hostnames)
- In a URL, you can give the hostname instead of its IP address
- Your browser will ask DNS to convert the hostname to its IP address
The Domain Name System (DNS)
- DNS acts like a directory enquiries system: it automatically takes hostnames and translates them into IP addresses
The port number
- One server might be offering ('hosting') more than one service
- E.g. a server computer may be running web server software and email server software
- How does a client indicate which server program is to handle its requests?
- Each server program is assigned an identification number, called a port number
- A client request includes the port number of the server program that should respond
Listening on ports
Well-known port numbers
- The Internet Assigned Numbers Authority (IANA) oversees the use of port numbers
- E.g. well-known port numbers:
- Directories/folders are organised hierarchically
- A pathname is typically a sequence of directories/folders
- Your machine might cache web pages, images, stylesheets, etc.
- If they get requested again, the request can be satisfied from the cache
- Some organizations use a proxy to cache pages for a group of users
Class exercise: What is the main problem with caching? How do you think it is solved?