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]. Anchors are identified by an anchor address: an absolute Uniform Resource Identifier (URI), optionally followed by a '#' and a sequence of characters called a fragment identifier. For example:
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.
Each of the following markup constructs indicates the tail anchor of a hyperlink or set of hyperlinks:
These markup constructs refer to head anchors by a URI, either absolute or relative, or a fragment identifier, or both.
In the case of a relative URI, the absolute URI in the address of the head anchor is the result of combining the relative URI with a base absolute URI as in [RELURL]. The base document is taken from the document's BASE element, if present; else, it is determined as in [RELURL].
Once the address of the head anchor is determined, the user agent may obtain a representation of the resource.
For example, if the base URI is `http://host/x/y.html' and the document contains:
then the user agent uses the URI `http://host/icons/abc.gif' to access the resource, as in [URL]..
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.
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. In particular, 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'.