This is a snapshot of an early working draft and has therefore been superseded by the HTML standard.
This document will not be further updated.
The a
, area
, and link
elements can, in certain situations described in the definitions of those
elements, represent hyperlinks.
The href
attribute on a hyperlink element must have a value that is a URI (or IRI).
This URI is the destination resource of the hyperlink.
The href
attribute on a
and area
elements is not required; when those
elements do not have href
attributes they do not represent
hyperlinks.
The href
attribute on the link
element
is required, but whether a link
element represents a hyperlink or not depends on the value of the rel
attribute of that
element.
The target
attribute, if
present, must be a valid browsing context name. User
agents use this name when following hyperlinks.
The ping
attribute, if present, gives the URIs of the resources that are interested
in being notified if the user follows the hyperlink. The value must be a
space separated list of one or more URIs (or IRIs). The value is used by
the user agent when following hyperlinks.
For a
and area
elements that represent hyperlinks, the
relationship between the document containing the hyperlink and the
destination resource indicated by the hyperlink is given by the value of
the element's rel
attribute, which must be an unordered set of
space-separated tokens. The allowed values and
their meanings are defined below. The rel
attribute has no
default value. If the attribute is omitted or if none of the values in the
attribute are recognised by the UA, then the document has no particular
relationship with the destination resource other than there being a
hyperlink between the two.
The media
attribute describes for which media the target document was designed. It
is purely advisory. The value must be a valid media query. [MQ] The default, if the media
attribute
is omitted or has an invalid value, is all
.
The hreflang
attribute on
hyperlink elements, if present, gives the language of the linked resource.
It is purely advisory. The value must be a valid RFC 3066 language code.
[RFC3066] User agents must not consider this
attribute authoritative — upon fetching the resource, user agents
must only use language information associated with the resource to
determine its language, not metadata included in the link to the resource.
The type
attribute, if present, gives the MIME type of the linked resource. It is
purely advisory. The value must be a valid MIME type, optionally with
parameters. [RFC2046] User agents must not
consider the type
attribute authoritative — upon
fetching the resource, user agents must not use metadata included in the
link to the resource to determine its type.
When a user follows a hyperlink, the user agent must navigate a browsing context to the URI of the hyperlink.
The URI of the hyperlink is URI given by resolving the the href
attribute of
that hyperlink relative to the hyperlink's element. In the case of
server-side image maps, the URI of the hyperlink must further have its
hyperlink suffix appended to it.
If the user indicated a specific browsing context when following the hyperlink, or if the user agent is configured to follow hyperlinks by navigating a particular browsing context, then that must be the browsing context that is navigated.
Otherwise, if the hyperlink element is an a
or area
element
that has a target
attribute, then the browsing context
that is navigated must be chosen by applying the
rules for chosing a browsing context given a browsing context name,
using the value of the target
attribute as the browsing context name.
If these rules result in the creation of a new browsing context, it must be navigated with replacement enabled.
Otherwise, if the hyperlink element is a sidebar hyperlink and the user agent implements a feature that can be considered a secondary browsing context, such a secondary browsing context may be selected as the browsing context to be navigated.
Otherwise, if the hyperlink element is an a
or area
element
with no target
attribute, but one of the child nodes of
the head
element is a base
element with a target
attribute, then
the browsing context that is navigated must be chosen by applying the rules for chosing a browsing context given a
browsing context name, using the value of the target
attribute of
the first such base
element as the
browsing context name. If these rules result in the creation of a new browsing context, it must be navigated with replacement enabled.
Otherwise, the browsing context that must be navigated is the same browsing context as the one which the hyperlink element itself is in.
If an a
or area
hyperlink element has a ping
attribute and
the user follows the hyperlink, the user agent must take the ping
attribute's
value, strip leading and trailing spaces, split the value on sequences of spaces, treat each
resulting part as a URI (resolving relative URIs according to element's
base URI) and then should send a request to each of the resulting URIs.
This may be done in parallel with the primary request, and is independent
of the result of that request.
User agents should allow the user to adjust this behaviour, for example
in conjunction with a setting that disables the sending of HTTP Referrer
headers. Based on the user's preferences, UAs may either ignore the ping
attribute altogether, or selectively ignore
URIs in the list (e.g. ignoring any third-party URIs).
For URIs that are HTTP URIs, the requests must be performed using the POST method (with an empty entity body in the request). User agents must ignore any entity bodies returned in the responses, but must, unless otherwise specified by the user, honour the HTTP headers — in particular, HTTP cookie headers. [RFC2965]
To save bandwidth, implementors might wish to consider
omitting optional headers such as Accept
from these requests.
When the ping
attribute is present, user agents should clearly indicate to the user that
following the hyperlink will also cause secondary requests to be sent in
the background, possibly including listing the actual target URIs.
The ping
attribute is redundant with pre-existing technologies like HTTP redirects
and JavaScript in allowing Web pages to track which off-site links are
most popular or allowing advertisers to track click-through rates.
However, the ping
attribute provides these advantages to the
user over those alternatives:
Thus, while it is possible to track users without this feature, authors
are encouraged to use the ping
attribute so that the user agent can improve
the user experience.
The following table summarises the link types that are defined by this specification. This table is non-normative; the actual definitions for the link types are given in the next few sections.
In this section, the term referenced document refers to the resource identified by the element representing the link, and the term current document refers to the resource within which the element representing the link finds itself.
To determine which link types apply to a link
, a
, or area
element, the element's rel
attribute must be split on spaces. The resulting tokens are the link
types that apply to that element.
Link type | Effect on... | Brief description | |
---|---|---|---|
link
| a and area
| ||
alternate |
Hyperlink | Hyperlink | Gives alternate representations of the current document. |
archives
| Hyperlink | Hyperlink | Provides a link to a collection of records, documents, or other materials of historical interest. |
author
| Hyperlink | Hyperlink | Gives a link to the current document's author. |
bookmark |
not allowed | Hyperlink | Gives the permalink for the nearest ancestor section. |
contact |
Hyperlink | Hyperlink | Gives a link to contact information for the current document. |
external |
not allowed | Hyperlink | Indicates that the referenced document is not part of the same site as the current document. |
feed
| Hyperlink | Hyperlink | Gives the address of a syndication feed for the current document. |
first
| Hyperlink | Hyperlink | Indicates that the current document is a part of a series, and that the first document in the series is the referenced document. |
help
| Hyperlink | Hyperlink | Provides a link to context-sensitive help. |
icon |
External Resource | not allowed | Imports an icon to represent the current document. |
index |
Hyperlink | Hyperlink | Gives a link to the document that provides a table of contents or index listing the current document. |
last
| Hyperlink | Hyperlink | Indicates that the current document is a part of a series, and that the last document in the series is the referenced document. |
license |
Hyperlink | Hyperlink | Indicates that the current document is covered by the copyright license described by the referenced document. |
next
| Hyperlink | Hyperlink | Indicates that the current document is a part of a series, and that the next document in the series is the referenced document. |
nofollow |
not allowed | Hyperlink | Indicates that the current document's original author or publisher does not endorse the referenced document. |
pingback
| External Resource | not allowed | Gives the address of the pingback server that handles pingbacks to the current document. |
prefetch
| External Resource | not allowed | Specifies that the target resource should be pre-emptively cached. |
prev |
Hyperlink | Hyperlink | Indicates that the current document is a part of a series, and that the previous document in the series is the referenced document. |
search |
Hyperlink | Hyperlink | Gives a link to a resource that can be used to search through the current document and its related pages. |
stylesheet |
External Resource | not allowed | Imports a stylesheet. |
sidebar |
Hyperlink | Hyperlink | Specifies that the referenced document, if retrieved, is intended to be shown in the browser's sidebar (if it has one). |
tag |
Hyperlink | Hyperlink | Gives a tag (identified by the given address) that applies to the current document. |
up
| Hyperlink | Hyperlink | Provides a link to a document giving the context for the current document. |
Some of the types described below list synonyms for these values. These are to be handled as specified by user agents, but must not be used in documents.
alternate
"The alternate
keyword may be used with link
, a
, and area
elements. For link
elements, if the rel
attribute does not also
contain the keyword stylesheet
, it creates a hyperlink; but if it
does also contains the keyword stylesheet
, the alternate
keyword instead modifies the
meaning of the stylesheet
keyword in the way described for
that keyword, and the rest of this subsection doesn't apply.
The alternate
keyword indicates that the referenced document is an alternate
representation of the current document.
The nature of the referenced document is given by the media
, hreflang
,
and type
attributes.
If the alternate
keyword is used with the media
attribute,
it indicates that the referenced document is intended for use with the
media specified.
If the alternate
keyword is used with the hreflang
attribute, and that attribute's value differs from the root element's language,
it indicates that the referenced document is a translation.
If the alternate
keyword is used with the type
attribute, it
indicates that the referenced document is a reformulation of the current
document in the specified format.
The media
, hreflang
, and type
attributes can
be combined when specified with the alternate
keyword.
For example, the following link is a French translation that uses the PDF format:
<link rel=alternate type=application/pdf hreflang=fr href=manual-fr>
If the alternate
keyword is used with the type
attribute set
to the value application/rss+xml
or the value application/atom+xml
, then the user agent must treat the
link as it would if it had the feed
keyword specified as well.
The alternate
link relationship is transitive — that is, if a document links to
two other documents with the link type "alternate
", then, in addition to implying
that those documents are alternative representations of the first
document, it is also implying that those two documents are alternative
representations of each other.
archives
"The archives
keyword may be used with link
, a
, and area
elements. For link
elements, it creates a
hyperlink.
The archives
keyword indicates that the referenced document describes a collection of
records, documents, or other materials of historical interest.
A blog's index page could link to an index of the blog's
past posts with rel="archives"
.
Synonyms: For historical reasons, user agents must also
treat the keyword "archive
" like the archives
keyword.
author
"The author
keyword
may be used with link
, a
, and area
elements. For link
elements, it creates a
hyperlink.
For a
and area
elements, the author
keyword indicates that the referenced
document provides further information about the author of the section that
the element defining the hyperlink applies
to.
For link
elements, the author
keyword indicates
that the referenced document provides further information about the author
for the page as a whole.
The "referenced document" can be, and often is, a mailto:
URI giving the e-mail address of the author. [MAILTO]
Synonyms: For historical reasons, user agents must also
treat link
, a
, and area
elements
that have a rev
attribute with the value
"made
" as having the author
keyword specified as a link relationship.
bookmark
"The bookmark
keyword may be used with a
and area
elements.
The bookmark
keyword gives a permalink for the nearest ancestor article
element of the linking element in
question, or of the section the linking
element is most closely associated with, if there are no ancestor
article
elements.
The following snippet has three permalinks. A user agent could determine which permalink applies to which part of the spec by looking at where the permalinks are given.
... <body> <h1>Example of permalinks</h1> <div id="a"> <h2>First example</h2> <p><a href="a.html" rel="bookmark">This</a> permalink applies to only the content from the first H2 to the second H2. The DIV isn't exactly that section, but it roughly corresponds to it.</p> </div> <h2>Second example</h2> <article id="b"> <p><a href="b.html" rel="bookmark">This</a> permalink applies to the outer ARTICLE element (which could be, e.g., a blog post).</p> <article id="c"> <p><a href="c.html" rel="bookmark">This</a> permalink applies to the inner ARTICLE element (which could be, e.g., a blog comment).</p> </article> </article> </body> ...
contact
"The contact
keyword may be used with link
, a
, and area
elements. For link
elements, it creates a
hyperlink.
For a
and area
elements, the contact
keyword indicates that the referenced
document provides further contact information for the section that the
element defining the hyperlink applies to.
User agents must treat any hyperlink in an address
element as having the contact
link type
specified.
For link
elements, the contact
keyword indicates
that the referenced document provides further contact information for the
page as a whole.
external
"The external
keyword may be used with a
and area
elements.
The external
keyword indicates that the link is leading to a document that is not part
of the site that the current document forms a part of.
feed
"The feed
keyword may be
used with link
, a
, and area
elements. For link
elements, it creates a
hyperlink.
The feed
keyword
indicates that the referenced document is a syndication feed. If the alternate
link type is
also specified, then the feed is specifically the feed for the current
document; otherwise, the feed is just a syndication feed, not necessarily
associated with a particular Web page.
The first link
, a
, or area
element
in the document (in tree order) that creates a hyperlink with the link
type feed
must be treated
as the default syndication feed for the purposes of feed autodiscovery.
The feed
keyword is implied by the alternate
link type in certain cases (q.v.).
The following two link
elements are
equivalent: both give the syndication feed for the current page:
<link rel="alternate" type="application/atom+xml" href="data.xml">
<link rel="feed alternate" href="data.xml">
The following extract offers various different syndication feeds:
<p>You can access the planets database using Atom feeds:</p> <ul> <li><a href="recently-visited-planets.xml" rel="feed">Recently Visited Planets</a></li> <li><a href="known-bad-planets.xml" rel="feed">Known Bad Planets</a></li> <li><a href="unexplored-planets.xml" rel="feed">Unexplored Planets</a></li> </ul>
help
"The help
keyword may be
used with link
, a
, and area
elements. For link
elements, it creates a
hyperlink.
For a
and area
elements, the help
keyword indicates that the referenced
document provides further help information for the parent of the element
defining the hyperlink, and its children.
In the following example, the form control has associated context-sensitive help. The user agent could use this information, for example, displaying the referenced document if the user presses the "Help" or "F1" key.
<p><label> Topic: <input name=topic> <a href="help/topic.html" rel="help">(Help)</a></label></p>
For link
elements, the help
keyword indicates that the
referenced document provides help for the page as a whole.
icon
"The icon
keyword may be
used with link
elements, for which it
creates an external
resource link.
The specified resource is an icon representing the page or site, and should be used by the user agent when representing the page in the user interface.
Icons could be auditory icons, visual icons, or other kinds of icons. If
multiple icons are provided, the user agent must select the most
appropriate icon according to the media
attribute.
license
"The license
keyword may be used with link
, a
, and area
elements. For link
elements, it creates a
hyperlink.
The license
keyword indicates that the referenced document provides the copyright
license terms under which the current document is provided.
Synonyms: For historical reasons, user agents must also
treat the keyword "copyright
" like the license
keyword.
nofollow
"The nofollow
keyword may be used with a
and area
elements.
The nofollow
keyword indicates that the link is not endorsed by the original author or
publisher of the page.
pingback
"The pingback
keyword may be used with link
elements,
for which it creates an external resource link.
For the semantics of the pingback
keyword, see the Pingback 1.0
specification. [PINGBACK]
prefetch
"The prefetch
keyword may be used with link
elements,
for which it creates an external resource link.
The prefetch
keyword indicates that preemptively fetching and caching the specified
resource is likely to be beneficial, as it is highly likely that the user
will require this resource.
search
"The search
keyword
may be used with link
, a
, and area
elements. For link
elements, it creates a
hyperlink.
The search
keyword
indicates that the referenced document provides an interface specifically
for searching the document and its related resources.
OpenSearch description documents can be used with link
elements and the search
link type to enable user agents to
autodiscover search interfaces.
stylesheet
"The stylesheet
keyword may be used with link
elements, for which it creates an external resource link
that contributes to the styling processing model.
The specified resource is a resource that describes how to present the document. Exactly how the resource is to be processed depends on the actual type of the resource.
If the alternate
keyword is also specified on the
link
element, then the link is an
alternative stylesheet.
sidebar
"The sidebar
keyword may be used with link
, a
, and area
elements. For link
elements, it creates a
hyperlink.
The sidebar
keyword indicates that the referenced document, if retrieved, is intended
to be shown in a secondary browsing context (if
possible), instead of in the current browsing
context.
A hyperlink element with with
the sidebar
keyword
specified is a sidebar
hyperlink.
tag
"The tag
keyword may be
used with link
, a
, and area
elements. For link
elements, it creates a
hyperlink.
The tag
keyword indicates
that the tag that the referenced document represents applies to
the current document.
Some documents form part of a hierarchical structure of documents.
A hierarchical structure of documents is one where each document can have various subdocuments. A subdocument is said to be a child of the document it is a subdocument of. The document of which it is a subdocument is said to be its parent. The children of a document have a relative order; the subdocument that precedes another is its previous sibling, and the one that follows it is its next sibling. A document with no parent forms the top of the hierarchy.
first
"The first
keyword may
be used with link
, a
, and area
elements. For link
elements, it creates a
hyperlink.
The first
keyword
indicates that the document is part of a hierarchical structure, and that
the link is leading to the document that is the first child of the current
document's parent document.
Synonyms: For historical reasons, user agents must also
treat the keywords "begin
" and "start
" like the first
keyword.
index
"The index
keyword may
be used with link
, a
, and area
elements. For link
elements, it creates a
hyperlink.
The index
keyword
indicates that the document is part of a hierarchical structure, and that
the link is leading to the document that is the top of the hierarchy.
Synonyms: For historical reasons, user agents must also
treat the keywords "top
", "contents
", and "toc
" like the index
keyword.
last
"The last
keyword may be
used with link
, a
, and area
elements. For link
elements, it creates a
hyperlink.
The last
keyword
indicates that the document is part of a hierarchical structure, and that
the link is leading to the document that is the last child of the current
document's parent document.
Synonyms: For historical reasons, user agents must also
treat the keyword "end
" like the last
keyword.
next
"The next
keyword may be
used with link
, a
, and area
elements. For link
elements, it creates a
hyperlink.
The next
keyword
indicates that the document is part of a hierarchical structure, and that
the link is leading to the document that is the next sibling of the
current document.
prev
"The prev
keyword may be
used with link
, a
, and area
elements. For link
elements, it creates a
hyperlink.
The prev
keyword
indicates that the document is part of a hierarchical structure, and that
the link is leading to the document that is the previous sibling of the
current document.
Synonyms: For historical reasons, user agents must also
treat the keyword "previous
" like the prev
keyword.
up
"The up
keyword may be used
with link
, a
, and area
elements. For link
elements, it creates a
hyperlink.
The up
keyword indicates
that the document is part of a hierarchical structure, and that the link
is leading to the document that is the parent of the current document.
Other than the types defined above, only types defined as extensions in
the WHATWG Wiki
RelExtensions page may be used with the rel
attribute on link
, a
, and area
elements. [WHATWGWIKI]
Anyone is free to edit the WHATWG Wiki RelExtensions page at any time to add a type. Extension types must be specified with the following information:
The actual value being defined. The value should not be confusingly similar to any other defined value (e.g. differing only in case).
link
One of the following:
link
elements.
link
element; it creates a hyperlink link.
link
element; it creates a external resource link.
a
and area
One of the following:
a
and area
elements.
a
and
area
elements; it creates a hyperlink.
A short description of what the keyword's meaning is.
A link to a more detailed description of the keyword's semantics and requirements. It could be another page on the Wiki, or a link to an external page.
A list of other keyword values that have exactly the same processing requirements. Authors must not use the values defined to be synonyms, they are only intended to allow user agents to support legacy content.
One of the following:
link
" and "Effect on... a
and area
"
information should be set to "not allowed".
If a keyword is added with the "proposal" status and found to be redundant with existing values, it should be removed and listed as a synonym for the existing value. If a keyword is added with the "proposal" status and found to be harmful, then it should be changed to "rejected" status, and its "Effect on..." information should be changed accordingly.
Conformance checkers must use the information given on the WHATWG Wiki RelExtensions page to establish if a value not explicitly defined in this specification is allowed or not. When an author uses a new type not defined by either this specification or the Wiki page, conformance checkers should offer to add the value to the Wiki, with the details described above, with the "proposal" status.
This specification does not define how new values will get approved. It is expected that the Wiki will have a community that addresses this.