In addition to general purpose elements such as paragraphs and lists, HTML documents can express hyperlinks. An HTML user agent allows the user to navigate these hyperlinks.
A hyperlink is a relationship between two anchors, called the head and the tail of the hyperlink[DEXTER]. Each anchor is addressed, or uniquely identified, by an absolute Uniform Resource Identifier (URI), optionally followed by a '#' and a sequence of characters called a fragment identifier, as per [RELURL]. For example:
http://www.w3.org/hypertext/WWW/TheProject.html http://www.w3.org/hypertext/WWW/TheProject.html#z31
In an anchor address, the URI refers to a resource; it may be used in a variety of information retrieval protocols to obtain an entity that represents the resource, such as an HTML document. The fragment identifier, if present, refers to some view on, or portion of the resource.
An HTML user agent begins navigation with an absolute URI, called the base URI, and an HTML document that is a representation of the resource identified by the base URI.
Each of the following markup constructs indicates the tail anchor of a hyperlink or set of hyperlinks:
These markup constructs refer to head anchors either directly by means of an absolute URI, or indirectly by means of a relative URI, which must be combined with the base URI as in [RELURL] to determine the address of the head anchor. The markup may also include fragment identifiers, separeted from the URI by a '#' character.
Once the address of the head anchor is determined, the user agent may obtain a representation of the resource, for example as in [URL].
For example, if the base URI is `http://host/x/y.html' and the document contains:
<img src="../icons/abc.gif">
then the user agent uses the URI `http://host/icons/abc.gif' to access the resource linked from the IMG element.
If the URI in the address of the head anchor is the same as the base URI, then the base document is sufficient as a representation of the resource. A user agent must not, for example, use any network information retrieval protocols to obtain a new representation of the resourse.
An HTML user agent allows the user to navigate the content of the document and request activation of hyperlinks denoted by A elements. HTML user agents should also allow activation of LINK element hyperlinks.
To activate a link, the user agent obtains a representation of the resource identified in the address of the head anchor. If the representation is another HTML document, navigation may begin again with this new document. The base URI for navigation is taken from the head anchor by default; however, any BASE tag in the destination document overrides this default. The process of obtaining the destination document may also override the base URI, as in the case of an HTTP `URI:' header or redirection transaction.
An HTML user agent may activate hyperlinks indicated by IMG and INPUT elements concurrently with processing the document; that is, image hyperlinks may be processed without explicit request by the user. Image resources should be embedded in the presentation at the point of the tail anchor, that is the IMG or INPUT element.
LINK hyperlinks may also be processed without explicit user request; for example, style sheet resources may be processed before or during the processing of the document.
Any characters following a `#' character in a hypertext address constitute a fragment identifier. As a degenerate case, an address of the form `#fragment' refers to an anchor in the same document.
The meaning of fragment identifiers depends on the media type of the representation of the anchor's resource. For `text/html' representations, it refers to the A element with a NAME attribute whose value is the same as the fragment identifier. The matching is case sensitive. The document should have exactly one such element. The user agent should indicate the anchor element, for example by scrolling to and/or highlighting the phrase.
For example, if the base URI is `http://host/x/y.html' and the user activated the link denoted by the following markup:
<p> See: <a href="app1.html#bananas">appendix 1</a> for more detail on bananas.
Then the user agent accesses the resource identified by `http://host/x/app1.html'. Assuming the resource is represented using the `text/html' media type, the user agent must locate the A element whose NAME attribute is `bananas' and begin navigation there.
The ISINDEX element represents a set of hyperlinks. The user can choose from the set by providing keywords to the user agent. The user agent computes the head URI by appending `?' and the keywords to the base URI. The keywords are escaped according to [URL] and joined by `+'. For example, if a document contains:
<BASE HREF="http://host/index"> <ISINDEX>
and the user provides the keywords `apple' and `berry', then the user agent must access the resource `http://host/index?apple+berry'.
FORM elements with `METHOD=GET' also represent sets of hyperlinks. See section Query Forms: METHOD=GET for details.
If the ISMAP attribute is present on an IMG element, the IMG element must be contained in an A element with an HREF present. This construct represents a set of hyperlinks. The user can choose from the set by choosing a pixel of the image. The user agent computes the head URI by appending `?' and the x and y coordinates of the pixel to the URI given in the A element. For example, if a document contains:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <head><title>ImageMap Example</title> <BASE HREF="http://host/index"></head> <body> <p> Choose any of these icons:<br> <a href="/cgi-bin/imagemap"><img ismap src="icons.gif"></a>
and the user chooses the upper-leftmost pixel, the chosen hyperlink is the one with the URI `http://host/cgi-bin/imagemap?0,0'.