aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/headers
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/api/headers')
-rw-r--r--files/zh-cn/web/api/headers/append/index.html84
-rw-r--r--files/zh-cn/web/api/headers/delete/index.html136
-rw-r--r--files/zh-cn/web/api/headers/entries/index.html117
-rw-r--r--files/zh-cn/web/api/headers/get/index.html137
-rw-r--r--files/zh-cn/web/api/headers/getall/index.html134
-rw-r--r--files/zh-cn/web/api/headers/has/index.html127
-rw-r--r--files/zh-cn/web/api/headers/headers/index.html129
-rw-r--r--files/zh-cn/web/api/headers/index.html185
-rw-r--r--files/zh-cn/web/api/headers/keys/index.html60
-rw-r--r--files/zh-cn/web/api/headers/set/index.html80
-rw-r--r--files/zh-cn/web/api/headers/values/index.html54
11 files changed, 1243 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/headers/append/index.html b/files/zh-cn/web/api/headers/append/index.html
new file mode 100644
index 0000000000..ca3477c5a0
--- /dev/null
+++ b/files/zh-cn/web/api/headers/append/index.html
@@ -0,0 +1,84 @@
+---
+title: Headers.append()
+slug: Web/API/Headers/append
+tags:
+ - Append
+ - Headers.append()
+translation_of: Web/API/Headers/append
+---
+<p>{{APIRef("Fetch")}}</p>
+
+<p>在一个<code>Headers</code>对象内部,{{domxref("Headers")}}接口的<strong><code>append()</code></strong>方法可以追加一个新值到已存在的headers上,或者新增一个原本不存在的header。</p>
+
+<p>{{domxref("Headers.set")}} 和 <code>append()</code> 两者之间的不同之处在于当指定header是已经存在的并且允许接收多个值时,{{domxref("Headers.set")}}会重写此值为新值,而<code>append()</code>会追加到值序列的尾部。</p>
+
+<p>因为安全性原因,一些headers仅受用户代理控制。包括{{Glossary("Forbidden_header_name", "forbidden header names", 1)}}和{{Glossary("Forbidden_response_header_name", "forbidden response header names", 1)}}。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="brush: js">myHeaders.append(name,value);</pre>
+
+<h3 id="参数">参数</h3>
+
+<dl>
+ <dt><em>name</em></dt>
+ <dd>要追加给Headers对象的HTTP header名称.</dd>
+ <dt><em>value</em></dt>
+ <dd>要追加给Headers对象的HTTP header值.</dd>
+</dl>
+
+<h3 id="返回">返回</h3>
+
+<p>Void.</p>
+
+<h2 id="例程">例程</h2>
+
+<p>创建一个空的Headers对象:</p>
+
+<pre class="brush: js">var myHeaders = new Headers(); // Currently empty</pre>
+
+<p>可以通过append()方法添加header:</p>
+
+<pre class="brush: js">myHeaders.append('Content-Type', 'image/jpeg');
+myHeaders.get('Content-Type'); // Returns 'image/jpeg'
+</pre>
+
+<p>如果指定header不存在, <code>append()</code>将会添加这个header并赋值 . 如果指定header已存在并允许有多个值, <code>append()</code>将会把指定值添加到值队列的末尾。</p>
+
+<pre class="brush: js">myHeaders.append('Accept-Encoding', 'deflate');
+myHeaders.append('Accept-Encoding', 'gzip');
+myHeaders.getAll('Accept-Encoding'); // Returns [ "deflate", "gzip" ]
+</pre>
+
+<p>要使用新值覆盖旧值,请使用{{domxref("Headers.set")}}。</p>
+
+<h2 id="规范">规范</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('Fetch','#dom-headers-append','append()')}}</td>
+ <td>{{Spec2('Fetch')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{Compat("api.Headers.append")}}</p>
+
+<div id="compat-mobile"> </div>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
+ <li><a href="/en-US/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li>
+ <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
+</ul>
diff --git a/files/zh-cn/web/api/headers/delete/index.html b/files/zh-cn/web/api/headers/delete/index.html
new file mode 100644
index 0000000000..12c52da4c0
--- /dev/null
+++ b/files/zh-cn/web/api/headers/delete/index.html
@@ -0,0 +1,136 @@
+---
+title: Headers.delete()
+slug: Web/API/Headers/delete
+translation_of: Web/API/Headers/delete
+---
+<p>{{APIRef("Fetch")}}{{ SeeCompatTable() }}</p>
+
+<p><strong><code>delete()</code></strong> 方法可以从Headers对象中删除指定header.</p>
+
+<p>下列原因将会导致该方法抛出一个<span style="line-height: 19.0909080505371px;">{{jsxref("TypeError")}}:</span></p>
+
+<ul>
+ <li><span style="line-height: 19.0909080505371px;">header名在HTTP header中是不存在的.</span></li>
+ <li><span style="line-height: 19.0909080505371px;"><span style="line-height: 19.0909080505371px;">header被锁定了.<span style="line-height: 19.0909080505371px;"><span style="line-height: 19.0909080505371px;">​</span></span></span></span></li>
+</ul>
+
+<div class="note">
+<p style="line-height: 19.0909080505371px;"><strong>Note:</strong>出于安全原因, 部分头信息只能被用户代理控制. 这些头信息包括 {{Glossary("Forbidden_header_name", "forbidden header names", 1)}}  和 {{Glossary("Forbidden_response_header_name", "forbidden response header names", 1)}}.</p>
+</div>
+
+<p style="line-height: 19.0909080505371px;"><strong style="font-size: 2.14285714285714rem; font-weight: 700; letter-spacing: -1px; line-height: 30px;">Syntax</strong></p>
+
+<pre class="brush: js">myHeaders.delete(name);</pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><em>name</em></dt>
+ <dd>需删除的HTTP header名称.</dd>
+</dl>
+
+<h3 id="Returns">Returns</h3>
+
+<p>Void.</p>
+
+<h2 id="Example">Example</h2>
+
+<p>创建一个空的Headers对象:</p>
+
+<pre class="brush: js">var myHeaders = new Headers(); // Currently empty</pre>
+
+<p>可以通过append()方法添加header:</p>
+
+<pre class="brush: js">myHeaders.append('Content-Type', 'image/jpeg');
+myHeaders.get('Content-Type'); // Returns 'image/jpeg'
+</pre>
+
+<p>可以通过delete()方法删除已有header:</p>
+
+<pre class="brush: js">myHeaders.delete('Content-Type');
+myHeaders.get('Content-Type'); // Returns null, as it has been deleted</pre>
+
+<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('Fetch','#dom-headers-delete','delete()')}}</td>
+ <td>{{Spec2('Fetch')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<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>{{ CompatChrome(42) }}<br>
+ {{ CompatChrome(41) }} behind pref<br>
+  </td>
+ <td>{{ CompatGeckoDesktop(39)}}<br>
+ 34 behind pref</td>
+ <td>{{ CompatNo }}</td>
+ <td>
+ <p>29<br>
+ 28 behind pref</p>
+ </td>
+ <td>{{ CompatNo }}</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>Firefox OS (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
+ <li><a href="/en-US/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li>
+ <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
+</ul>
diff --git a/files/zh-cn/web/api/headers/entries/index.html b/files/zh-cn/web/api/headers/entries/index.html
new file mode 100644
index 0000000000..abcc44ce61
--- /dev/null
+++ b/files/zh-cn/web/api/headers/entries/index.html
@@ -0,0 +1,117 @@
+---
+title: Headers.entries()
+slug: Web/API/Headers/entries
+translation_of: Web/API/Headers/entries
+---
+<p>{{APIRef}}{{SeeCompatTable}}</p>
+
+<p><code><strong>Headers.entries()</strong></code> 以 {{jsxref("Iteration_protocols","迭代器")}} 的形式返回Headers对象中所有的键值对. </p>
+
+<div class="note">
+<p><strong>Note</strong>: 这个方法在 <a href="/en-US/docs/Web/API/Web_Workers_API">Web Workers</a>中是可用的.</p>
+</div>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox">headers.entries();</pre>
+
+<h3 id="Return_value">Return value</h3>
+
+<p>返回一个 {{jsxref("Iteration_protocols","迭代器")}}.</p>
+
+<h2 id="Example">Example</h2>
+
+<pre class="brush: js;highlight:[7]">// Create a test Headers object
+var myHeaders = new Headers();
+myHeaders.append('Content-Type', 'text/xml');
+myHeaders.append('Vary', 'Accept-Language');
+
+// Display the key/value pairs
+for (var pair of myHeaders.entries()) {
+ console.log(pair[0]+ ': '+ pair[1]);
+}
+</pre>
+
+<p>返回结果:</p>
+
+<pre>content-type: text/xml
+vary: Accept-Language</pre>
+
+<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('Fetch','#headers-class','Headers.entries() (as iterator&lt;&gt;)')}}</td>
+ <td>{{Spec2('Fetch')}}</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</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoDesktop(44)}}</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>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>Firefox OS (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile(44)}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
+ <li><a href="/en-US/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li>
+ <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
+</ul>
diff --git a/files/zh-cn/web/api/headers/get/index.html b/files/zh-cn/web/api/headers/get/index.html
new file mode 100644
index 0000000000..7ef3dfffc7
--- /dev/null
+++ b/files/zh-cn/web/api/headers/get/index.html
@@ -0,0 +1,137 @@
+---
+title: Headers.get()
+slug: Web/API/Headers/get
+tags:
+ - get()
+translation_of: Web/API/Headers/get
+---
+<p>{{APIRef("Fetch")}}{{ SeeCompatTable() }}</p>
+
+<p><strong><code>get()</code></strong> 方法以 {{domxref("ByteString")}} 形式从Headers对象中返回指定header的全部值. 如果Header对象中不存在请求的header,则返回 <code>null</code>.</p>
+
+<div class="note">
+<p><strong>Note:</strong>出于安全原因, 部分头信息只能被用户代理控制. 这些头信息包括 {{Glossary("Forbidden_header_name", "forbidden header names", 1)}}  和 {{Glossary("Forbidden_response_header_name", "forbidden response header names", 1)}}.</p>
+</div>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="brush: js">myHeaders.get(name);</pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><em>name</em></dt>
+ <dd>从Headers对象中检索的HTTP header 名,如果HTTP header中不存在指定header名则会抛出一个{{jsxref("TypeError")}}.</dd>
+</dl>
+
+<h3 id="Returns">Returns</h3>
+
+<p>以 {{domxref("ByteString")}} 形式返回检索到的值.</p>
+
+<h2 id="Example">Example</h2>
+
+<p>创建一个空的Headers对象:</p>
+
+<pre class="brush: js">var myHeaders = new Headers(); // Currently empty</pre>
+
+<p>可以通过get()方法来获取header中的值:</p>
+
+<pre class="brush: js">myHeaders.append('Content-Type', 'image/jpeg');
+myHeaders.get('Content-Type'); // Returns 'image/jpeg'
+</pre>
+
+<p>如果存在多个header值,那么只有第一个值会被返回:</p>
+
+<pre class="brush: js">myHeaders.append('Accept-Encoding', 'deflate');
+myHeaders.append('Accept-Encoding', 'gzip');
+myHeaders.get('Accept-Encoding'); // Returns <code>"deflate,gzip"</code>
+</pre>
+
+<div class="note">
+<p><strong>Note</strong>: {{domxref("Headers.getAll")}} used to have this functionality, with {{domxref("Headers.get")}} returning only the first value added to the <code>Headers</code> object. The latest spec has removed <code>getAll()</code>, and updated <code>get()</code> to return all values.</p>
+</div>
+
+<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('Fetch','#dom-headers-get','get()')}}</td>
+ <td>{{Spec2('Fetch')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<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>{{ CompatChrome(42) }}<br>
+ {{ CompatChrome(41) }} behind pref<br>
+  </td>
+ <td>{{ CompatGeckoDesktop(39)}}<br>
+ 34 behind pref</td>
+ <td>{{ CompatNo }}</td>
+ <td>
+ <p>29<br>
+ 28 behind pref</p>
+ </td>
+ <td>{{ CompatNo }}</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>Firefox OS (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
+ <li><a href="/en-US/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li>
+ <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
+</ul>
diff --git a/files/zh-cn/web/api/headers/getall/index.html b/files/zh-cn/web/api/headers/getall/index.html
new file mode 100644
index 0000000000..a9a2d22e59
--- /dev/null
+++ b/files/zh-cn/web/api/headers/getall/index.html
@@ -0,0 +1,134 @@
+---
+title: Headers.getAll()
+slug: Web/API/Headers/getAll
+translation_of: Web/API/Headers/getAll
+---
+<p>{{APIRef("Fetch")}}{{ SeeCompatTable() }}</p>
+
+<p><strong><code>getAll()</code></strong> 方法会以数组形式返回指定header的所有值. 如果指定的header未存在,则返回一个空数组.</p>
+
+<div class="note">
+<p><strong>Note:</strong>出于安全原因, 部分头信息只能被用户代理控制. 这些头信息包括 {{Glossary("Forbidden_header_name", "forbidden header names", 1)}}  和 {{Glossary("Forbidden_response_header_name", "forbidden response header names", 1)}}.</p>
+</div>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="brush: js">myHeaders.getAll(name);</pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><em>name</em></dt>
+ <dd>需检索的HTTP header名称. 如果HTTP header中不存在指定名称<span style="line-height: 19.0909080505371px;">则抛出一个 </span><span style="line-height: 19.0909080505371px;">{{jsxref("TypeError")}}.</span></dd>
+</dl>
+
+<h3 id="Returns">Returns</h3>
+
+<p>An {{domxref("Array")}} containing a {{domxref("ByteString")}} sequence representing the values of the retrieved header.</p>
+
+<h2 id="Example">Example</h2>
+
+<p>Creating an empty <code>Headers</code> object is simple:</p>
+
+<pre class="brush: js">var myHeaders = new Headers(); // Currently empty</pre>
+
+<p>You could add a header to this using {{domxref("Headers.append")}}, then retrieve it using <code>getAll()</code>:</p>
+
+<pre class="brush: js">myHeaders.append('Content-Type', 'image/jpeg');
+myHeaders.getAll('Content-Type'); // Returns [ "image/jpeg" ]
+</pre>
+
+<p>If the header has multiple values associated with it, the array will contain all the values, in the order they were added to the Headers object:</p>
+
+<pre class="brush: js">myHeaders.append('Accept-Encoding', 'deflate');
+myHeaders.append('Accept-Encoding', 'gzip');
+myHeaders.getAll('Accept-Encoding'); // Returns [ "deflate", "gzip" ]</pre>
+
+<div class="note">
+<p><strong>Note</strong>: Use {{domxref("Headers.get")}} to return only the first value added to the <code>Headers</code> object.</p>
+</div>
+
+<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('Fetch','#dom-headers-getall','getAll()')}}</td>
+ <td>{{Spec2('Fetch')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<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>{{ CompatChrome(42) }}<br>
+ {{ CompatChrome(41) }} behind pref<br>
+  </td>
+ <td>{{ CompatGeckoDesktop(39)}}<br>
+ 34 behind pref</td>
+ <td>{{ CompatNo }}</td>
+ <td>
+ <p>29<br>
+ 28 behind pref</p>
+ </td>
+ <td>{{ CompatNo }}</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>Firefox OS (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
+ <li><a href="/en-US/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li>
+ <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
+</ul>
diff --git a/files/zh-cn/web/api/headers/has/index.html b/files/zh-cn/web/api/headers/has/index.html
new file mode 100644
index 0000000000..471bd1fb90
--- /dev/null
+++ b/files/zh-cn/web/api/headers/has/index.html
@@ -0,0 +1,127 @@
+---
+title: Headers.has()
+slug: Web/API/Headers/has
+translation_of: Web/API/Headers/has
+---
+<div>{{APIRef("Fetch")}}</div>
+
+<p>{{domxref("Headers")}} 接口的 <strong><code>has()</code></strong>方法返回一个布尔值来声明一个 <code>Headers</code>对象 是否包含特定的头信息.</p>
+
+<p>考虑到安全因素, 一些头信息只能被user agent来管理. 这些头信息包括{{Glossary("Forbidden_header_name", "forbidden header names", 1)}}  和{{Glossary("Forbidden_response_header_name", "forbidden response header names", 1)}}.</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="brush: js">myHeaders.has(name);</pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><em>name</em></dt>
+ <dd>你要测试的HTTP头字段的名称。如果给出的名称不在HTTP头中,将爬出异常{{jsxref("TypeError")}}。</dd>
+</dl>
+
+<h3 id="Returns">Returns</h3>
+
+<p>A {{domxref("Boolean")}}.</p>
+
+<h2 id="Example">Example</h2>
+
+<p>创建一个空的Headers对象是简单的:</p>
+
+<pre class="brush: js">var myHeaders = new Headers(); // Currently empty</pre>
+
+<p>你可以使用{{domxref("Headers.append")}}来向myHeaders添加一个头信息, 然后使用 <code>has()方法来测试是否添加成功</code>:</p>
+
+<pre class="brush: js">myHeaders.append('Content-Type', 'image/jpeg');
+myHeaders.has('Content-Type'); // Returns true
+myHeaders.has('Accept-Encoding'); // Returns false
+</pre>
+
+<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('Fetch','#dom-headers-has','has()')}}</td>
+ <td>{{Spec2('Fetch')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatChrome(42) }}<br>
+ {{ CompatChrome(41) }} behind pref<br>
+  </td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{ CompatGeckoDesktop(39)}}<br>
+ 34 behind pref</td>
+ <td>{{ CompatNo }}</td>
+ <td>
+ <p>29<br>
+ 28 behind pref</p>
+ </td>
+ <td>{{ CompatNo }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>Firefox OS (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
+ <li><a href="/en-US/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li>
+ <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
+</ul>
diff --git a/files/zh-cn/web/api/headers/headers/index.html b/files/zh-cn/web/api/headers/headers/index.html
new file mode 100644
index 0000000000..956904968d
--- /dev/null
+++ b/files/zh-cn/web/api/headers/headers/index.html
@@ -0,0 +1,129 @@
+---
+title: Headers()
+slug: Web/API/Headers/Headers
+tags:
+ - Headers
+ - Headers构造函数
+translation_of: Web/API/Headers/Headers
+---
+<p>{{APIRef("Fetch")}}{{ SeeCompatTable() }}</p>
+
+<p><code>使用<strong>Headers()</strong></code> 构造方法创建一个新的{{domxref("Headers")}} 对象.</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="brush: js">var myHeaders = new Headers(init);</pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><em>init</em> {{optional_inline}}</dt>
+ <dd>通过一个包含任意 <a href="/en-US/docs/Web/HTTP/Headers">HTTP headers</a> 的对象来预设你的 <code>Headers</code>. 可以是一个{{domxref("ByteString")}} 对象; 或者是一个已存在的 <code>Headers</code> 对象. </dd>
+</dl>
+
+<h2 id="Example">Example</h2>
+
+<p>创建一个空的 <code>Headers</code> 对象:</p>
+
+<pre class="brush: js">var myHeaders = new Headers(); // Currently empty</pre>
+
+<p>你可以使用{{domxref("Headers.append")}}方法添加一个header并赋值:</p>
+
+<pre class="brush: js">myHeaders.append('Content-Type', 'image/jpeg');
+myHeaders.get('Content-Type'); // Returns 'image/jpeg'
+</pre>
+
+<p>或者你可以在Headers对象创建时添加多个header. 在下面的示例中我们创建了一个新的{{domxref("Headers")}} 对象, 并通过Headers构造函数中init属性来添加多个header:</p>
+
+<pre class="brush: js">var httpHeaders = { 'Content-Type' : 'image/jpeg', 'Accept-Charset' : 'utf-8', 'X-My-Custom-Header' : 'Zeke are cool' };
+var myHeaders = new Headers(httpHeaders);</pre>
+
+<p><code><font face="Open Sans, Arial, sans-serif">你可以通过init属性将一个已存在的</font>Headers对象来创建另一个新的Headers对象</code>:</p>
+
+<pre class="brush: js">var secondHeadersObj = new Headers(myHeaders);
+secondHeadersObj.get('Content-Type'); // Would return 'image/jpeg' — it inherits it from the first headers object</pre>
+
+<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('Fetch','#dom-headers','Headers()')}}</td>
+ <td>{{Spec2('Fetch')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<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>{{ CompatChrome(42) }}<br>
+ {{ CompatChrome(41) }} behind pref<br>
+  </td>
+ <td>{{ CompatGeckoDesktop(39)}}<br>
+ 34 behind pref</td>
+ <td>{{ CompatNo }}</td>
+ <td>
+ <p>29<br>
+ 28 behind pref</p>
+ </td>
+ <td>{{ CompatNo }}</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>Firefox OS (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
+ <li><a href="/en-US/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li>
+ <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
+</ul>
diff --git a/files/zh-cn/web/api/headers/index.html b/files/zh-cn/web/api/headers/index.html
new file mode 100644
index 0000000000..75a7b51982
--- /dev/null
+++ b/files/zh-cn/web/api/headers/index.html
@@ -0,0 +1,185 @@
+---
+title: Headers
+slug: Web/API/Headers
+tags:
+ - Headers
+ - Headers API
+ - application/json
+ - 头信息
+translation_of: Web/API/Headers
+---
+<p>{{ APIRef("Fetch") }}</p>
+
+<p><a href="/en-US/docs/Web/API/Fetch_API">Fetch API</a> 的 <strong>Headers </strong>接口允许您对HTTP请求和响应头执行各种操作。 这些操作包括检索,设置,添加和删除。 一个Headers对象具有关联的头列表,它最初为空,由零个或多个键值对组成。你可以使用<span style="line-height: 19.0909080505371px;"> </span>{{domxref("Headers.append","append()")}} <span style="line-height: 19.0909080505371px;">方法添加 </span>之类的方法添加到此(参见 {{anch("Examples")}})。在该接口的所有方法中,标题名称由不区分大小写的字节序列匹配。</p>
+
+<p>出于安全考虑,某些头只能由用户代理控制。这些头信息包括 {{Glossary("Forbidden_header_name", "forbidden header names", 1)}}  和 {{Glossary("Forbidden_response_header_name", "forbidden response header names", 1)}}。</p>
+
+<p>一个Headers对象也有一个关联的guard,它具有不可变的值,<code>request</code>,<code>request-no-cors</code>,<code>response</code>或<code>none</code>。 这会影响 {{domxref("Headers.set","set()")}}, {{domxref("Headers.delete","delete()")}}, 和{{domxref("Headers.append","append()")}} 方法 改变header. 参考更多信息,请看 {{Glossary("Guard")}}.</p>
+
+<p>你可以通过 {{domxref("Request.headers")}} 和{{domxref("Response.headers")}} 属性检索一个<code>Headers</code>对象, 并使用 {{domxref("Headers.Headers()")}} 构造函数创建一个新的<code>Headers</code> 对象.</p>
+
+<p>一个实现了<code>Headers</code> 的对象可以直接用于 {{jsxref("Statements/for...of", "for...of")}} 结构中, 而不是 {{domxref('Headers.entries()', 'entries()')}}: <code>for (var p of myHeaders)</code> 等价于 <code>for (var p of myHeaders.entries())</code>.</p>
+
+<div class="note">
+<p><strong>Note</strong>: 您可以通过阅读我们的 <a href="/en-US/docs/Web/HTTP/Headers">HTTP headers</a>参考找到更多关于可用headers的信息。</p>
+</div>
+
+<h2 id="构造函数">构造函数</h2>
+
+<dl>
+ <dt>{{domxref("Headers.Headers()")}}</dt>
+ <dd>创建一个新的Headers对象.</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{domxref("Headers.append()")}}</dt>
+ <dd>给现有的header添加一个值, 或者添加一个未存在的header并赋值.</dd>
+ <dt>{{domxref("Headers.delete()")}}</dt>
+ <dd>从Headers对象中删除指定header.</dd>
+ <dt>{{domxref("Headers.entries()")}}</dt>
+ <dd>以 {{jsxref("Iteration_protocols","迭代器")}} 的形式返回Headers对象中所有的键值对.</dd>
+ <dt>{{domxref("Headers.get()")}}</dt>
+ <dd>以 {{domxref("ByteString")}} 的形式从Headers对象中返回指定header的全部值.</dd>
+ <dt>{{domxref("Headers.has()")}}</dt>
+ <dd>以布尔值的形式从Headers对象中返回是否存在指定的header.</dd>
+ <dt>{{domxref("Headers.keys()")}}</dt>
+ <dd>以{{jsxref("Iteration_protocols", "迭代器")}}的形式返回Headers对象中所有存在的header名.</dd>
+ <dt>{{domxref("Headers.set()")}}</dt>
+ <dd>替换现有的header的值, 或者添加一个未存在的header并赋值.</dd>
+ <dt>{{domxref("Headers.values()")}}</dt>
+ <dd>以{{jsxref("Iteration_protocols", "迭代器")}}的形式返回Headers对象中所有存在的header的值.</dd>
+</dl>
+
+<div class="note">
+<p><strong>Note</strong>: 值得注意的是,在header已存在或者有多个值的状态下{{domxref("Headers.set()")}} 和 {{domxref("Headers.append()")}}的使用有如下区别, {{domxref("Headers.set()")}} 将会用新的值覆盖已存在的值, 但是{{domxref("Headers.append()")}}会将新的值添加到已存在的值的队列末尾. 请参相关词条内的示例代码.</p>
+</div>
+
+<div class="note">
+<p><strong>Note</strong>:如果您尝试传入名称不是<a href="https://fetch.spec.whatwg.org/#concept-header-name">有效的HTTP头名称</a>的引用,则所有Headers方法都将引发 <code>TypeError</code> 。 如果头部有一个不变的{{Glossary("Guard")}},则变异操作将会抛出一个 <code>TypeError</code> 。 在其他任何失败的情况下,他们默默地失败。</p>
+</div>
+
+<h3 id="Obsolete_methods">Obsolete methods</h3>
+
+<dl>
+ <dt>{{domxref("Headers.getAll()")}}</dt>
+ <dd>用于返回具有给定名称的 <code>Headers</code> 对象中所有值的数组; 这个方法现在已经从规范中删除了,{{domxref("Headers.get()")}} 方法现在返回所有的值而不是一个。</dd>
+</dl>
+
+<h2 id="范例">范例</h2>
+
+<p>在这个小示例中, 我们将会通过Headers构造函数创建一个新的header, 先使用append()方法添加一个header, 然后通过get()方法返回这个header的值</p>
+
+<pre class="brush: js">let myHeaders = new Headers();
+
+myHeaders.append('Content-Type', 'text/xml');
+
+myHeaders.get('Content-Type');
+// should return 'text/xml'
+</pre>
+
+<h2 id="规范">规范</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('Fetch','#headers-class','Headers')}}</td>
+ <td>{{Spec2('Fetch')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<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>{{ CompatChrome(42) }}<br>
+ {{ CompatChrome(41) }} behind pref<br>
+  </td>
+ <td>{{ CompatGeckoDesktop(39)}}<br>
+ 34 behind pref</td>
+ <td>{{ CompatNo }}</td>
+ <td>
+ <p>29<br>
+ 28 behind pref</p>
+ </td>
+ <td>{{ CompatNo }}</td>
+ </tr>
+ <tr>
+ <td><code>entries()</code>, <code>keys()</code>, <code>values()</code>, and support of <code>for...of</code></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{ CompatGeckoDesktop(44)}}</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>Firefox OS (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ </tr>
+ <tr>
+ <td><code>entries()</code>, <code>keys()</code>, <code>values()</code>, and support of <code>for...of</code></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{ CompatGeckoMobile(44)}}</td>
+ <td>2.5</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="相关链接">相关链接</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
+ <li><a href="/en-US/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li>
+ <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
+</ul>
+
+<p> </p>
diff --git a/files/zh-cn/web/api/headers/keys/index.html b/files/zh-cn/web/api/headers/keys/index.html
new file mode 100644
index 0000000000..add32d5afb
--- /dev/null
+++ b/files/zh-cn/web/api/headers/keys/index.html
@@ -0,0 +1,60 @@
+---
+title: Headers.keys()
+slug: Web/API/Headers/keys
+translation_of: Web/API/Headers/keys
+---
+<div>{{APIRef}}</div>
+
+<div><code><strong>Headers.keys() </strong></code>方法返回一个 headers(Object) 对象所有 key 组成的迭代器,通过迭代器可以遍历 headers 这个对象,返回的迭代器中的元素 key 都是字符串。</div>
+
+<div class="note">
+<p><strong>注意</strong>: 这个方法在 <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API">Web Workers</a> 也可以使用。</p>
+</div>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">headers.keys();</pre>
+
+<h3 id="返回值">返回值</h3>
+
+<p>返回 <code>headers</code> 对象中所有 key 组成的迭代器 {{jsxref("Iteration_protocols","iterator")}}。</p>
+
+<h2 id="示例">示例</h2>
+
+<pre class="brush: js;highlight:[7]">// 创建一个 Headers 对象
+var myHeaders = new Headers();
+myHeaders.append('Content-Type', 'text/xml');
+myHeaders.append('Vary', 'Accept-Language');
+
+// 显示 Headers 中所有的 key
+for(var key of myHeaders.keys()) {
+ console.log(key);
+}
+</pre>
+
+<p>控制台打印结果:</p>
+
+<pre>content-type
+vary</pre>
+
+<h2 id="浏览器兼容">浏览器兼容</h2>
+
+<div>
+<div class="hidden"></div>
+
+<div class="hidden">此页面上的兼容性表是根据结构化数据生成的。如果您想为数据做出贡献,请查看<a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> 并向我们发送拉取请求。</div>
+
+<p>{{Compat("api.Headers.keys")}}</p>
+</div>
+
+<h2 id="相关链接">相关链接</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
+ <li><a href="/en-US/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li>
+ <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
+</ul>
+
+<p>
+ <audio style="display: none;"></audio>
+</p>
diff --git a/files/zh-cn/web/api/headers/set/index.html b/files/zh-cn/web/api/headers/set/index.html
new file mode 100644
index 0000000000..fb6f477238
--- /dev/null
+++ b/files/zh-cn/web/api/headers/set/index.html
@@ -0,0 +1,80 @@
+---
+title: Headers.set()
+slug: Web/API/Headers/set
+translation_of: Web/API/Headers/set
+---
+<div>{{APIRef("Fetch")}}</div>
+
+<p><strong><code><a href="https://developer.mozilla.org/en-US/docs/Web/API/Headers">headers</a></code></strong>接口中 <strong><code>set()</code></strong> 方法在可以在已经声明中的<code><strong>headers</strong></code>对象修改已有的一组键值对或者创建一个新的键值对。</p>
+
+<p><strong><code>set()</code></strong> 方法和 <a href="https://developer.mozilla.org/en-US/docs/Web/API/Headers/append">append()</a>方法不同的是声明的<strong><code>Headers</code></strong>对象是否已经存在对应的<strong><code>keys</code></strong>是否已经存在并且已经赋值。<strong><code>set()</code></strong> 方法将会覆盖之前的<strong><code>value</code></strong>,然而 <a href="https://developer.mozilla.org/en-US/docs/Web/API/Headers/append">append()</a>方法只会在<strong><code>Headers</code></strong>对象的尾部添加一个新的键值对。</p>
+
+<p>为了安全策略,一些 <strong><code>Headers</code></strong>对象中的键值对只能客户端去控制。这些<strong><code>key</code></strong>包括<a href="https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name">Forbidden response header name</a> 和 <a href="https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_response_header_name">Forbidden responese header names</a> 。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox"><em>myHeaders</em>.set(<em>name</em>, <em>value</em>);</pre>
+
+<h3 id="参数">参数</h3>
+
+<dl>
+ <dt><code>name</code></dt>
+ <dd><strong><code>name</code></strong>就是需要对HTTP header 设置新值的key, 一般为字符串。如果设置的<strong><code>name</code></strong> 不是HTTP header规范里面规定的name,那么将会抛出错误"TypeError"。</dd>
+ <dt><code>value</code></dt>
+ <dd> <strong><code>value </code></strong>就是 <strong><code>name </code></strong>对应的值。</dd>
+</dl>
+
+<h3 id="返回">返回</h3>
+
+<p>Void.</p>
+
+<h2 id="Example">Example</h2>
+
+<p>创建一个新的 <code>Headers</code> 对象:</p>
+
+<pre class="brush: js">var myHeaders = new Headers(); // Currently empty</pre>
+
+<p>你可以用<a href="https://developer.mozilla.org/en-US/docs/Web/API/Headers/append">append()</a>方法给<code>Headers</code> 对象增添一个新的键值对,然后用<code><strong>set()</strong></code>方法去改变这个键值对:</p>
+
+<pre class="brush: js">myHeaders.append('Content-Type', 'image/jpeg');
+myHeaders.set('Content-Type', 'text/html');
+</pre>
+
+<p>如果这个键值对不存在,那么<strong><code>set()</code></strong>方法首先创建一个键值对,然后给它赋值。如果这个键值对存在,那么<code><strong>set()</strong></code>方法将会覆盖之前的<strong><code>value</code></strong>值:</p>
+
+<pre class="brush: js">myHeaders.set('Accept-Encoding', 'deflate');
+myHeaders.set('Accept-Encoding', 'gzip');
+myHeaders.get('Accept-Encoding'); // Returns 'gzip'</pre>
+
+<p>如果你需要增加一个键值对,而不是要覆盖之前的键值对,那么你需要用<a href="https://developer.mozilla.org/en-US/docs/Web/API/Headers/append">append()</a>方法。</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('Fetch','#dom-headers-set','set()')}}</td>
+ <td>{{Spec2('Fetch')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("api.Headers.set")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
+ <li><a href="/en-US/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li>
+ <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
+</ul>
diff --git a/files/zh-cn/web/api/headers/values/index.html b/files/zh-cn/web/api/headers/values/index.html
new file mode 100644
index 0000000000..293957bd3d
--- /dev/null
+++ b/files/zh-cn/web/api/headers/values/index.html
@@ -0,0 +1,54 @@
+---
+title: Headers.values()
+slug: Web/API/Headers/values
+translation_of: Web/API/Headers/values
+---
+<div>{{APIRef}}</div>
+
+<p><code><strong>Headers.values()</strong></code>方法返回一个可迭代数值,通过这个数值可以遍历<code><strong>Headers</strong></code>中键值对的<code><strong>value</strong></code>值。返回的<code><strong>value</strong></code>都是<strong><code>ByteString</code></strong>对象。</p>
+
+<div class="note">
+<p><strong>注意</strong>: 这个方法可以在 <a href="/en-US/docs/Web/API/Web_Workers_API">Web Workers</a>中使用。</p>
+</div>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">headers.values();</pre>
+
+<h3 id="返回值">返回值</h3>
+
+<p>返回一个由键值对中<strong><code>value</code></strong>组成的数组。</p>
+
+<h2 id="例子">例子</h2>
+
+<pre class="brush: js;highlight:[7]">// Create a test Headers object
+var myHeaders = new Headers();
+myHeaders.append('Content-Type', 'text/xml');
+myHeaders.append('Vary', 'Accept-Language');
+
+// Display the values
+for (var value of myHeaders.values()) {
+ console.log(value);
+}
+</pre>
+
+<p>返回值为:</p>
+
+<pre>text/xml
+Accept-Language</pre>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<div>
+
+
+<p>{{Compat("api.Headers.values")}}</p>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
+ <li><a href="/en-US/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li>
+ <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
+</ul>