ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
Last Update: 5 January 1998

4.13.1 HREF in Anchors

As mentioned previously, anchors mark the beginning or end of hypertext links. The HREF attribute (which is actually optional) marks the anchor as the start of a link to another document or resource (it could point, for example, to an image file), or to a particular place in another document.

The address of the referenced document can be specified by an absolute or partial URL:

<A HREF="URL"> anchor </A>

were URL (Uniform Resource Locator) is the URL of the document to be accessed. For example HREF can use http: to access other HTML documents, images, etc. or it can use ftp: or gopher:. It can even indicate a telnet: connection. See the URL document for more information on the possibilities.

Partial URLs are also possible when accessing any server, but are particularly common within document collections on http servers. These are convenient for referencing documents that come from the same server as the current document -- that is, the one currently being viewed. In this case you need only specify the location of the document relative to the current one. Here are some examples of the varied possibilities:
HTML document served by the specified http server.
Compressed tar file accessed via anonymous ftp from the indicated site.
A relative URL: the HTML document comes from the same http server but in the directory OtherStuff, found two levels up from the directory the current document was served from.
A telnet session to the indicated machine.

Links to a Particular Place in a Document

Particular places in an HTML document can be marked as specific destinations of hypertext links via the NAME attribute. For example, suppose a place in a document is marked via the anchor:

<A NAME="proj1">Project 1</A>
From within this document we can create a hypertext link to this place by specifying the anchor:
<A HREF="#proj1">(see Project 1)</A>
If we wanted to reference this place from another document in the same directory we would put
<A HREF="doc.html#proj1">(see Project 1)</A>
and so on.

Special http URLs

HTTP Servers often allocate special URL paths for gateway programs. The most common one is /cgi-bin, but just about any name is possible -- this is a parameter that is configured on the HTTP server. This is used to reference a server script or gateway program directory -- this special directory contains scripts and programs that can be accessed from the browsers, via an HREF. For example, to access the script `phone' (which scans a phonebook for particular names) on the machine `' via HTTP, the HREF might be:


For more information look at Section 6; you should also consult you local Web (http) server documentation.

ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
© 1994-1998 by Ian Graham
Last Update: 5 January 1998