Name
Link — an HTML hyperlink
Inherits from
Node, Element
Synopsis
HTML links are created with <a>,
<area>, and <link> elements. <a> tags are used in the body of a
document to create hyperlinks. <area> tags are a rarely used
feature for creating “image maps.” <link> tags are used in the <head> of a document to refer to
external resources such as stylesheets and icons. The <a> and <area> elements have the same
representation in JavaScript. <link> elements have a somewhat
different JavaScript representation, but, for convenience, these two
types of links are documented together on this page.
When a Link object that represents an <a> element is used as a string, it
returns the value of its href
property.
Properties
In addition to the properties listed here, a Link object also
has properties that reflect the underlying HTML attributes: hreflang, media, ping, rel, sizes, target, and type. Note that the URL decomposition
properties (such as host and
pathname) that return portions of
the link’s href are only defined
for <a> and <area> elements, not for <link> elements, and that the
sheet, disabled, and relList properties are only defined for
<link> elements that refer
to stylesheets.
booleandisabledFor
<link>elements that refer to stylesheets, this property controls whether the stylesheet is applied to the document or not.stringhashSpecifies the fragment identifier of
href, including the leading hash (#) mark—for example, “#results”.stringhostSpecifies the hostname and port portions of
href ...