aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/htmllinkelement/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/api/htmllinkelement/index.html')
-rw-r--r--files/zh-cn/web/api/htmllinkelement/index.html128
1 files changed, 128 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmllinkelement/index.html b/files/zh-cn/web/api/htmllinkelement/index.html
new file mode 100644
index 0000000000..f7b3811c5c
--- /dev/null
+++ b/files/zh-cn/web/api/htmllinkelement/index.html
@@ -0,0 +1,128 @@
+---
+title: HTMLLinkElement
+slug: Web/API/HTMLLinkElement
+tags:
+ - API
+ - HTML DOM
+ - HTMLLInkElement
+ - Interface
+ - NeedsTranslation
+ - Reference
+ - TopicStub
+translation_of: Web/API/HTMLLinkElement
+---
+<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>
+
+<p>{{InheritanceDiagram(600, 120)}}</p>
+
+<h2 id="Properties">Properties</h2>
+
+<p><em>Inherits properties from its parent, {{domxref("HTMLElement")}}, and {{domxref("LinkStyle")}}.</em></p>
+
+<dl>
+ <dt> </dt>
+ <dt>{{domxref("HTMLLinkElement.as")}}</dt>
+ <dd>Is a {{domxref("DOMString")}} representing the type of content being loaded by the HTML link.</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 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 for the target resource.</dd>
+ <dt>{{domxref("HTMLLinkElement.hreflang")}}</dt>
+ <dd>Is a {{domxref("DOMString")}} representing 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("HTMLLinkElement.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 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.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.type")}}</dt>
+ <dd>Is a {{domxref("DOMString")}} representing the MIME type of the linked resource.</dd>
+</dl>
+
+<h3 id="Obsolete_properties">Obsolete properties</h3>
+
+<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.rev")}} {{obsolete_inline}}</dt>
+ <dd>Is a {{domxref("DOMString")}} representing the reverse relationship of the linked resource from the resource to the document.
+ <div class="note"><strong>Note</strong>: Currently the W3C HTML 5.2 spec states that <code>rev</code> is no longer obsolete, whereas the WHATWG living standard still has it labeled obsolete. Until this discrepancy is resolved, you should still assume it is obsolete.</div>
+ </dd>
+ <dt>{{domxref("HTMLLinkElement.target")}} {{obsolete_inline}}</dt>
+ <dd>Is a {{domxref("DOMString")}} representing the name of the target frame to which the resource applies.</dd>
+</dl>
+
+<p> </p>
+
+<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("Preload")}}</td>
+ <td>{{Spec2("Preload")}}</td>
+ <td>Defines <code>&lt;link rel="preload"&gt;</code>, and the <code>as</code> property. Note that currently Firefox only supports preloading of cacheable resources.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML WHATWG', "semantics.html#the-link-element", "HTMLLinkElement")}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td>Adds the following properties: <code>crossOrigin</code>, <code>referrerPolicy</code>, and <code>as</code>.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML5.1', "document-metadata.html#the-link-element", "HTMLLinkElement")}}</td>
+ <td>{{Spec2('HTML5.1')}}</td>
+ <td> </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>
+
+
+<p>{{Compat("api.HTMLLinkElement")}}</p>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>The HTML element implementing this interface: {{HTMLElement("link")}}.</li>
+</ul>