aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/http/headers/link/index.html
blob: f76e635f756e884f39c3c79be917189a1d1e1cc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
title: Link
slug: Web/HTTP/Headers/Link
translation_of: Web/HTTP/Headers/Link
---
<p>{{HTTPSidebar}}{{Draft}}</p>

<p>HTTP实体报头 <strong><code>Link</code></strong> 提供了序列化HTTP头部链接的方法。它在语义上与HTML元素 {{HTMLElement("link")}} 相等。</p>

<h2 id="语法">语法</h2>

<pre class="syntaxbox">Link: &lt; <var>uri-reference</var> &gt;; <var>param1</var>=<var>value1</var>; <var>param2</var>="<var>value2</var>"</pre>

<dl>
 <dt><code>&lt;uri-reference&gt;</code></dt>
 <dd>URI reference 必须要用 <code>&lt;</code><code>&gt;</code>来关闭。</dd>
</dl>

<h3 id="参数">参数</h3>

<p>link头部包含以 <code>;</code> 分隔的参数,这些参数与HTML元素 {{HTMLElement("link")}} 的属性一致。</p>

<h2 id="示例">示例</h2>

<p>URI 必须要用 <code>&lt;</code><code>&gt; 来关闭:</code></p>

<pre class="brush: http; no-line-numbers example-good">Link: &lt;https://example.com&gt;; rel="preload"</pre>

<pre class="brush: http; no-line-numbers example-bad">Link: https://bad.example; rel="preload"</pre>

<h2 id="规范">规范</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comments</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{RFC(8288, "Link Serialisation in HTTP Headers", 3)}}</td>
   <td><span class="spec-RFC">IETF RFC</span></td>
   <td></td>
  </tr>
  <tr>
   <td>{{RFC(5988, "The Link Header Field", 5)}}</td>
   <td><span class="spec-RFC">IETF RFC</span></td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>



<p>{{Compat("http.headers.Link")}}</p>

<h2 id="参见">参见</h2>

<ul>
 <li>{{HTTPStatus(103, "103 Early Hints")}}</li>
</ul>