Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1123623 of HTMLLinkElement

  • Revision slug: Web/API/HTMLLinkElement
  • Revision title: HTMLLinkElement
  • Revision id: 1123623
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment bug 1264165

Revision Content

{{ APIRef("HTML DOM") }}

The HTMLLinkElement interface represents reference information for external resources and the relationship of those resources to a document and vice-versa. This object inherits all of the properties and methods of the {{domxref("HTMLElement")}} interface.

Properties

Inherits properties from its parent, {{domxref("HTMLElement")}}, and {{domxref("LinkStyle")}}.

{{domxref("HTMLLinkElement.charset")}} {{obsolete_inline}}
Is a {{domxref("DOMString")}} representing the character encoding for the target resource.
{{domxref("HTMLLinkElement.crossOrigin")}} {{experimental_inline}}
Is a {{domxref("DOMString")}} that corresponds to the CORS setting for this link element. See CORS settings attributes for details.
{{domxref("HTMLLinkElement.disabled")}}
Is a Boolean which represents whether the link is disabled; currently only used with style sheet links.
{{domxref("HTMLLinkElement.href")}}
Is a {{domxref("DOMString")}} representing the URI for the target resource.
{{domxref("HTMLLinkElement.hreflang")}}
Is a {{domxref("DOMString")}} representing the language code for the linked resource.
{{domxref("HTMLLinkElement.media")}}
Is a {{domxref("DOMString")}} representing a list of one or more media formats to which the resource applies.
{{domxref("HTMLAnchorElement.referrerPolicy")}} {{experimental_inline}}
Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("referrerpolicy", "link")}} HTML attribute indicating which referrer to use.
{{domxref("HTMLLinkElement.rel")}}
Is a {{domxref("DOMString")}} representing the forward relationship of the linked resource from the document to the resource.
{{domxref("HTMLLinkElement.relList")}} {{readonlyInline}}
Is a {{domxref("DOMTokenList")}} that reflects the {{htmlattrxref("rel", "link")}} HTML attribute, as a list of tokens.
{{domxref("HTMLLinkElement.rev")}} {{obsolete_inline}}
Is a {{domxref("DOMString")}} representing the reverse relationship of the linked resource from the resource to the document.
{{domxref("HTMLLinkElement.sizes")}} {{readonlyInline}}
Is a {{domxref("DOMSettableTokenList")}} that reflects the {{htmlattrxref("sizes", "link")}} HTML attribute, as a list of tokens.
{{domxref("LinkStyle.sheet")}} {{readonlyInline}}
Returns the {{domxref("StyleSheet")}} object associated with the given element, or null if there is none.
{{domxref("HTMLLinkElement.target")}} {{obsolete_inline}}
Is a {{domxref("DOMString")}} representing the name of the target frame to which the resource applies.
{{domxref("HTMLLinkElement.type")}}
Is a {{domxref("DOMString")}} representing the MIME type of the linked resource.

Methods

No specific method; inherits methods from its parent, {{domxref("HTMLElement")}}, and {{domxref("LinkStyle")}}.

Specifications

Specification Status Comment
{{SpecName('HTML WHATWG', "semantics.html#the-link-element", "HTMLLinkElement")}} {{Spec2('HTML WHATWG')}} The following property has been added: crossOrigin.
{{SpecName('HTML5.1', "document-metadata.html#the-link-element", "HTMLLinkElement")}} {{Spec2('HTML5.1')}}  
{{SpecName('HTML5 W3C', "document-metadata.html#the-link-element", "HTMLLinkElement")}} {{Spec2('HTML5 W3C')}} The following properties are now obsolete: charset, rev, and shape.
The following properties have been added: relList, and sizes.
{{SpecName('DOM2 HTML', 'html.html#ID-35143001', 'HTMLLinkElement')}} {{Spec2('DOM2 HTML')}} Added a second inheritence, the {{domxref("LinkStyle")}} interface.
{{SpecName('DOM1', 'level-one-html.html#ID-35143001', 'HTMLLinkElement')}} {{Spec2('DOM1')}} Initial definition.

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatVersionUnknown}} {{CompatGeckoDesktop(1.0)}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
sizes {{CompatUnknown}} {{CompatNo}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
crossOrigin {{experimental_inline}} {{CompatUnknown}} {{CompatGeckoDesktop(18)}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
referrerPolicy {{CompatUnknown}} {{CompatGeckoDesktop(50)}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{CompatGeckoMobile(1.0)}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
sizes {{CompatUnknown}} {{CompatNo}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
crossOrigin {{experimental_inline}} {{CompatUnknown}} {{CompatGeckoMobile(18)}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
referrerPolicy {{CompatUnknown}} {{CompatGeckoMobile(50)}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}

See also

  • The HTML element implementing this interface: {{HTMLElement("link")}}.

Revision Source

<div>
<div>{{ APIRef("HTML DOM") }}</div>
</div>

<p>The <strong><code>HTMLLinkElement</code></strong> interface represents reference information for external resources and the relationship of those resources to a document and vice-versa. This object inherits all of the properties and methods of the {{domxref("HTMLElement")}} interface.</p>

<h2 id="Properties">Properties</h2>

<p><em>Inherits properties from its parent, {{domxref("HTMLElement")}}, and {{domxref("LinkStyle")}}.</em></p>

<dl>
 <dt>{{domxref("HTMLLinkElement.charset")}} {{obsolete_inline}}</dt>
 <dd>Is a {{domxref("DOMString")}} representing the character encoding for the target resource.</dd>
 <dt>{{domxref("HTMLLinkElement.crossOrigin")}} {{experimental_inline}}</dt>
 <dd>Is a {{domxref("DOMString")}} that corresponds to the CORS setting for this link element. See <a href="/en-US/docs/HTML/CORS_settings_attributes" title="HTML/CORS settings attributes">CORS&nbsp;settings attributes</a> for details.</dd>
 <dt>{{domxref("HTMLLinkElement.disabled")}}</dt>
 <dd>Is a <code>Boolean</code> which represents whether the link is disabled; currently only used with style sheet links.</dd>
 <dt>{{domxref("HTMLLinkElement.href")}}</dt>
 <dd>Is a {{domxref("DOMString")}} representing the URI&nbsp;for the target resource.</dd>
 <dt>{{domxref("HTMLLinkElement.hreflang")}}</dt>
 <dd>Is a {{domxref("DOMString")}} representing&nbsp;the language code for the linked resource.</dd>
 <dt>{{domxref("HTMLLinkElement.media")}}</dt>
 <dd>Is a {{domxref("DOMString")}} representing a list of one or more media formats to which the resource applies.</dd>
 <dt>{{domxref("HTMLAnchorElement.referrerPolicy")}} {{experimental_inline}}</dt>
 <dd>Is a {{domxref("DOMString")}} that reflects the {{htmlattrxref("referrerpolicy", "link")}} HTML attribute indicating which referrer to use.</dd>
 <dt>{{domxref("HTMLLinkElement.rel")}}</dt>
 <dd>Is a {{domxref("DOMString")}} representing&nbsp;the forward relationship of the linked resource from the document to the resource.</dd>
 <dt>{{domxref("HTMLLinkElement.relList")}} {{readonlyInline}}</dt>
 <dd>Is a {{domxref("DOMTokenList")}} that reflects the {{htmlattrxref("rel", "link")}} HTML attribute, as a list of tokens.</dd>
 <dt>{{domxref("HTMLLinkElement.rev")}} {{obsolete_inline}}</dt>
 <dd>Is a {{domxref("DOMString")}} representing the reverse relationship of the linked resource from the resource to the document.</dd>
 <dt>{{domxref("HTMLLinkElement.sizes")}} {{readonlyInline}}</dt>
 <dd>Is a {{domxref("DOMSettableTokenList")}} that reflects the {{htmlattrxref("sizes", "link")}} HTML attribute, as a list of tokens.</dd>
 <dt>{{domxref("LinkStyle.sheet")}} {{readonlyInline}}</dt>
 <dd>Returns the {{domxref("StyleSheet")}} object associated with the given element, or <code>null</code> if there is none.</dd>
 <dt>{{domxref("HTMLLinkElement.target")}} {{obsolete_inline}}</dt>
 <dd>Is a {{domxref("DOMString")}} representing&nbsp;the name of the target frame to which the resource applies.</dd>
 <dt>{{domxref("HTMLLinkElement.type")}}</dt>
 <dd>Is a {{domxref("DOMString")}} representing&nbsp;the MIME type of the linked resource.</dd>
</dl>

<h2 id="Methods">Methods</h2>

<p><em>No specific method; inherits methods from its parent, {{domxref("HTMLElement")}}</em><em>, and {{domxref("LinkStyle")}}.</em></p>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG', "semantics.html#the-link-element", "HTMLLinkElement")}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>The following property has been added: <code>crossOrigin</code>.</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5.1', "document-metadata.html#the-link-element", "HTMLLinkElement")}}</td>
   <td>{{Spec2('HTML5.1')}}</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', "document-metadata.html#the-link-element", "HTMLLinkElement")}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td>The following properties are now obsolete: <code>charset</code>, <code>rev</code>, and <code>shape</code>.<br />
    The following properties have been added: <code>relList</code>, and <code>sizes</code>.</td>
  </tr>
  <tr>
   <td>{{SpecName('DOM2 HTML', 'html.html#ID-35143001', 'HTMLLinkElement')}}</td>
   <td>{{Spec2('DOM2 HTML')}}</td>
   <td>Added a second inheritence, the {{domxref("LinkStyle")}} interface.</td>
  </tr>
  <tr>
   <td>{{SpecName('DOM1', 'level-one-html.html#ID-35143001', 'HTMLLinkElement')}}</td>
   <td>{{Spec2('DOM1')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<div>{{CompatibilityTable}}</div>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoDesktop(1.0)}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td><code>sizes</code></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td><code>crossOrigin</code> {{experimental_inline}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoDesktop(18)}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td><code>referrerPolicy</code></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoDesktop(50)}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Phone</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoMobile(1.0)}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
  <tr>
   <td><code>sizes</code></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td><code>crossOrigin</code> {{experimental_inline}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoMobile(18)}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td><code>referrerPolicy</code></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoMobile(50)}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li>The HTML element implementing this interface: {{HTMLElement("link")}}.</li>
</ul>
Revert to this revision