aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/http/headers/accept-ch/index.html
blob: ded134ff4d9ce815071050e617042811df56a4e3 (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
---
title: Accept-CH
slug: Web/HTTP/Headers/Accept-CH
translation_of: Web/HTTP/Headers/Accept-CH
---
<div>{{HTTPSidebar}}{{securecontext_header}}{{SeeCompatTable}}</div>

<p><code><strong>Accept-CH</strong></code> 头由服务器设置,以指定客户端应在后续请求中应包含哪些客户端<a href="/en-US/docs/Glossary/Client_hints">Client Hints</a>提示头。</p>



<table class="properties">
 <tbody>
  <tr>
   <th scope="row">Header type</th>
   <td>{{Glossary("Response header")}}</td>
  </tr>
  <tr>
   <th scope="row">{{Glossary("Forbidden header name")}}</th>
   <td>?</td>
  </tr>
 </tbody>
</table>

<div class="blockIndicator note">
<p><strong>注意:</strong> <a href="/en-US/docs/Glossary/Client_hints">Client Hints</a>只能在安全源(通过TLS)上访问。所有安全的请求都应该持久化Accept-CH和Accept-CH-Lifetime头,以确保<a href="/en-US/docs/Glossary/Client_hints">Client Hints</a>可靠地发送。</p>
</div>

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

<pre class="syntaxbox">Accept-CH: &lt;list of client hints&gt;
</pre>

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

<pre>Accept-CH: DPR, Viewport-Width
Accept-CH: Width
Accept-CH-Lifetime: 86400
Vary: DPR, Viewport-Width, Width
</pre>

<div class="blockIndicator note">
<p><strong>注意:</strong>  牢记要根据所接受的Client Hints<a href="https://developer.mozilla.org/en-US/docs/Glossary/Client_hints#Varying_Client_Hints">更改响应</a></p>
</div>

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

<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>

<p>{{Compat("http.headers.Accept-CH")}}</p>

<h2 id="相关内容">相关内容</h2>

<ul>
 <li>{{HTTPHeader("Accept-CH-Lifetime")}}</li>
 <li>{{HTTPHeader("Vary")}}</li>
</ul>