<LINK...>

The Link element indicates a relationship between the document and some other object. A document may have any number of Link elements.

The Link element is empty (does not have a closing element), but takes the same attributes as the Anchor element.

The <LINK> element would typically be used to provide pointers to related indexes, or glossaries. Links can also be used to indicate a static tree structure in which the document was authored by pointing to a "parent" and "next" and "previous" document. Mosaic (v3.0 for Windows 95/NT4) totally supports the <LINK> element and presents the user with a toolbar populated with buttons for every <LINK> element specified.<LINK REL="..."> is one that Mosaic recognises, it will show the toolbar button with a pre-set graphic, together with whatever text is specified in the TITLE attribute, as the text on the button. The remote location, specified in the HREF attribute is the location that Mosaic will browse to when the button is clicked. Below is a list of the possible preset REL attributes that Mosaic recognises together with the graphic it uses for the toolbar button (on Windows 95 systems).

REL="stylesheet"
This details the stylesheet to be used for the current page. Internet Explorer (from v3.0) and Netscape (from v4.0) supports style sheets and Mosaic presents no pre-set graphic for this but supplies 'Stylesheet' if no TITLE attribute is given.
REL="home" ()
This can be used to link to any page that the browser should consider the 'home' page of the current site. Supplies 'Home' if no TITLE attribute is given.
REL="toc"|"contents" ()
This directs users to the table of contents for your site. 'toc' and 'contents' are interchangeable as the REL attribute value and Mosaic supplies 'ToC' if no TITLE attribute is given.
REL="index" ()
This can be used to link to the index of your site. Supplied with 'Index' if no TITLE attribute is given.
REL="glossary" ()
This creates a link to the glossary of your site. Supplies 'Glossary' if no TITLE attribute is given.
REL="copyright" ()
If your site contains a page detailing copyright attributions, it can be linked to by this REL attribute value. Mosaic supplies 'Copyright' if no TITLE attribute is given.
REL="up"|"parent" (|)
This can be used to set the location of the current documents parent document. For example, your site may conform to a fairly rigid navigation structure and this attribute value can be used to link the current document to an overview of the current document set. Supplied with 'Up' or 'Parent' if no TITLE is given.
REL="child" ()
This can be used to set the location of the current documents 'child' document(s). For example, your site may conform to a fairly rigid navigation structure and this attribute value can be used to link the current document to any of the documents in the level below. I.e. from an overview document to a detail document. Supplied with 'Child' if no TITLE is given.
REL="next" ()
As in the above case, this can be used to provide a link to the next document in the current document set. Mosaic supplies 'Next' if no TITLE attribute is given.
REL="previous" ()
As above, this can be used to link to the previous document in the flow of the current document set. Supplied with 'Previous' if no TITLE attribute is given.
REL="last"|"end" ()
This can be used to link to the last document in the current document set. Mosaic supplies 'End' if no TITLE is given.
REL="first" ()
This can be used to link to the first document in the current document set. Mosaic supplies 'Begin' if no TITLE is given.
REL="help" ()
If your site contains a 'help' file (i.e. tips on site navigation for example), then it can be linked to via this attribute setting. Mosaic supplies 'Help' if no TITLE is given.

You can set the REL attribute to be anything you like, as well as the above pre-sets. Mosaic will supply a default image () for these toolbar buttons and will use the text 'Bookmark' if no TITLE attribute is provided.

Mosaic also supports use of the REV="made" attribute/value. This should be used to denote the author of the document and the HREF attribute should use a HREF="mailto:address@site.com" structure. Mosaic will use its default graphic (see above) and default text ('Bookmark') if no TITLE attribute is given.

The <LINK> element represents one of the primary style sheet inclusion mechanism elements. It can be used to specify the location of the style sheet that is to be used for the document.

<HTML>
<HEAD>
<TITLE>This HTML document uses a style sheet</TITLE>
<LINK REL="stylesheet"
TYPE="text/css"
HREF="http://www.stylesheets.com/sheets/formal.css"
TITLE="formal">
</HEAD>
<BODY>
Rest of the document goes here
</BODY>
</HTML>

In the above HTML fragment, the <LINK> element points to the file "formal.css" at the given URL. It tells the browser that :

For more information about these specific attributes, see the <A> section and for more general information about style sheets, see the style sheets section.

The <LINK> element is also key to Netscape's 'dynamic fonts' concept, where the font specified in the <LINK> element is automatically downloaded when the page is viewed. To do this, use REL="fontdef in the <LINK> element:

<LINK REL="fontdef" SRC="http://site/path/fontdef.pfr">

where the fontdef.pfr file provides the font definition file. (Producing font definition files is outside the scope of this document. For more information, visit http://home.netscape.com/comprod/products/communicator/fonts/index.html. Also, note that Internet Explorer supports dynamic fonts, using standard W3C Style sheet methods. See the Style Sheets topic for more details.

DISABLED
This Internet Explorer 4.0 specific attribute specifies that the StyleSheet object referenced by the <LINK> element is disabled. Basically, it means its style sheet declarations won't be used.


Consistent with Internet Explorer 4.0's Dynamic HTML object model, the <LINK> element supports various properties and methods. In its role as a document structure element/relationship describer, it supports a few events. Note that all scripting of the <LINK> element is Internet Explorer 4.0 specific.

<LINK...> Properties
Of the Standard Dynamic HTML properties, <BASE> supports className, document, id, parentElement, sourceIndex, tagName and title. See the Standard Dynamic HTML properties topic for details.
Also, the <LINK> element supports the href, disabled and rel properties, which directly reflect any settings of their respective attributes (see above) and the readyState property.

The readyState property can be one of 4 values, depending on the current state of the resource, referenced in the HREF attribute. The possible values of the readyState property are:

Value Meaning
complete The resource has completely loaded and is available to the document and therefore manipulation.
interactive The resource hasn't completely downloaded, but is available to the document and scripting
loading The resource is being downloaded
uninitialized The resource is not available - normally, this value indicates that the resource is downloading

Note that the readystate property is read-only.

<LINK...> Methods
Of the Standard Dynamic HTML methods, <LINK> supports contains, getAttribute, removeAttribute and setAttribute. See the Standard Dynamic HTML methods topic for details.

<LINK...> Events
The <LINK> element doesn't support any of the Standard Dynamic HTML events, but does support the following events.

onerror
This event is fired when an error occurs in the downloading of the links resource referenced on the HREF attribute. Normally, this would mean that the resource hasn't downloaded properly and so isn't available to the document, or manipulation through scripting.

onload
The onload event is fired immediately after the resource begins downloading. It does not mean that the resource is available, merely that its download has begun.

onreadystatechange
At any time, the resource may change its readyState property and when this happens, the onreadystatechange event is fired.

See also: