There are two main kinds of links. Both use the <a>
tag, but differ in how they resolve the path to the resource being linked to.
First, be aware that you can link to anything. Most links will be to other web pages, but you can also link to PDF files, images, .zip archives, or anything else. If the browser can handle the linked media (either by itself or through co-operating with a plugin) it will display it - otherwise, the user will be prompted to download and save the file.
Second, be aware that while we are assuming that you will be linked to an HTTP resource, this need not always be the case. Other web protocols can also be used within the <a>
tag, including FTP, RTSP, and many others.
To determine the kind of link you will use, you need to answer a series of simple questions:
- Is the resource you are linking to local to the page you are linking from? i.e., does it exist in the same website? If the answer is yes, you will be using a local or relative link (both terms refer to the same form of link.)
- Alternatively, is the thing you are linking outside of your control, i.e. outside your website? If the answer is yes, you will be using a remote or absolute link (again, both terms are synonyms for each other).
Photograph by Hernán Piñera, used under a Creative Commons Attribution ShareAlike 2.0 Generic license
Enjoy this piece? I invite you to follow me at twitter.com/dudleystorey to learn more.