next up previous contents
Next: Special Characters Up: The World Wide Previous: Pre-Formatted Text

A note on links

In the examples above, we've shown two forms of links - an absolute URL such as is used in this image link:
<img src=http://www.cs.ucl.ac.uk/uk/london/tower_bridge.gif>
and relative links such as:
<img src=tower_bridge.gif>

If this relative link were in a page of HTML with the URL
http://www.cs.ucl.ac.uk/uk/london/index.html
then the client assumes that the protocol ( http), the remote computer ( www.cs.ucl.ac.uk) and the directory ( /uk/london) are all the same as those in the page containing the link, and so it actually requests the data with the absolute URL
http://www.cs.ucl.ac.uk/uk/london/tower_bridge.gif

Another possibility is to specify relative URLs with the full directory and filename - the client knows that you mean this because the directory name begins with a slash (`` /''). For example, the relative link above could have also been written:
<img src=/uk/london/tower_bridge.gif>

You can even use relative directory names using Unix style relative pathnames. For example, an HTML page with the URL
http://www.cs.ucl.ac.uk/uk/intro.html
could use the following link the the same picture of Tower Bridge:
<img src=london/tower_bridge.gif>
and an HTML page with the URL:
http://www.cs.ucl.ac.uk/uk/london/east_end/docks.html
could use a link such as:
<img src=../tower_bridge.html>
Note that the `` ../'' here refers to the parentgif directory of the current directory in the directory tree.



Jon Crowcroft
Wed May 10 11:46:29 BST 1995