diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:43:23 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:43:23 -0500 |
commit | 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 (patch) | |
tree | a9ef8ac1e1b8fe4207b6d64d3841bfb8990b6fd0 /files/zh-tw/web/http/headers/accept | |
parent | 074785cea106179cb3305637055ab0a009ca74f2 (diff) | |
download | translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.gz translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.bz2 translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.zip |
initial commit
Diffstat (limited to 'files/zh-tw/web/http/headers/accept')
-rw-r--r-- | files/zh-tw/web/http/headers/accept/index.html | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/files/zh-tw/web/http/headers/accept/index.html b/files/zh-tw/web/http/headers/accept/index.html new file mode 100644 index 0000000000..e0544a0bc6 --- /dev/null +++ b/files/zh-tw/web/http/headers/accept/index.html @@ -0,0 +1,92 @@ +--- +title: Accept +slug: Web/HTTP/Headers/Accept +translation_of: Web/HTTP/Headers/Accept +--- +<div>{{HTTPSidebar}}</div> + +<p><strong><code>Accept</code></strong> HTTP 請求標頭(以 <a href="/zh-TW/docs/Web/HTTP/Basics_of_HTTP/MIME_types">MIME type</a> 標示)會對伺服器告知用戶端可解讀的內容類型。伺服器可以透過 <a href="/zh-TW/docs/Web/HTTP/Content_negotiation">content negotiation</a> 來選用可行的協定,並以 {{HTTPHeader("Content-Type")}} 標頭告知用戶端。針對本標頭,瀏覽器可以根據完成請求的脈絡,來決定適合的數值:像是擷取 CSS 時,給予的值就會和圖片、影像、腳本不一樣。</p> + +<table class="properties"> + <tbody> + <tr> + <th scope="row">標頭類型</th> + <td>{{Glossary("Request header")}}</td> + </tr> + <tr> + <th scope="row">{{Glossary("Forbidden header name")}}</th> + <td>no</td> + </tr> + <tr> + <th scope="row">{{Glossary("CORS-safelisted request header")}}</th> + <td>yes, with the additional restriction that values can't contain a <em>CORS-unsafe request header byte</em>: <code>"():<>?@[\]{}</code>, Delete, Tab and control characters: 0x00 to 0x19.</td> + </tr> + </tbody> +</table> + +<h2 id="語法">語法</h2> + +<pre class="syntaxbox">Accept: <MIME_type>/<MIME_subtype> +Accept: <MIME_type>/* +Accept: */* + +// Multiple types, weighted with the {{glossary("quality values", "quality value")}} syntax: +Accept: text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, */*;q=0.8 +</pre> + +<h2 id="指令">指令</h2> + +<dl> + <dt><code><MIME_type>/<MIME_subtype></code></dt> + <dd>一個精確的 <a href="/zh-TW/docs/Web/HTTP/Basics_of_HTTP/MIME_types">MIME type</a>,例如<code>text/html</code>。</dd> + <dt><code><MIME_type>/*</code></dt> + <dd>一個不指定子類的 MIME type。<code>image/*</code> 會配對到 <code>image/png</code>, <code>image/svg</code>, <code>image/gif</code> 和等圖片類型。</dd> + <dt><code>*/*</code></dt> + <dd>所有 MIME type</dd> + <dt><code>;q=</code> (q-factor weighting)</dt> + <dd>Any value used is placed in an order of preference expressed using relative <a href="/en-US/docs/Glossary/Quality_values">quality value</a> called the <em>weight</em>.</dd> +</dl> + +<h2 id="示例">示例</h2> + +<pre>Accept: text/html + +Accept: image/* + +// General default +Accept: */* + +// Default for navigation requests +Accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8 +</pre> + +<h2 id="規範">規範</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">規範</th> + <th scope="col">標題</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{RFC("7231", "Accept", "5.3.2")}}</td> + <td>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Context</td> + </tr> + </tbody> +</table> + +<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")}}</p> + +<h2 id="參見">參見</h2> + +<ul> + <li>HTTP <a href="/zh-TW/docs/Web/HTTP/Content_negotiation">content negotiation</a></li> + <li>Header with the result of the content negotiation: {{HTTPHeader("Content-Type")}}</li> + <li>類似標頭:{{HTTPHeader("TE")}}, {{HTTPHeader("Accept-Encoding")}}, {{HTTPHeader("Accept-Charset")}}, {{HTTPHeader("Accept-Language")}}</li> +</ul> |