aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/http/content_negotiation/accept_默认值/index.html
blob: 9db586865700c314b3ec58046f6def0f6eed9417 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
---
title: Accept 默认值
slug: Web/HTTP/Content_negotiation/Accept_默认值
translation_of: Web/HTTP/Content_negotiation/List_of_default_Accept_values
---
<div>{{HTTPSidebar}}</div>

<p><span class="seoSummary">本文介绍了在一些特定输入和浏览器版本下的HTTP  <code><a href="/en-US/docs/Web/HTTP/Headers/Accept">Accept</a></code> 头的默认值</span></p>

<h2 id="默认值">默认值</h2>

<p>这些值将在上下文未设置其它信息时被使用。 注意:所有的浏览器都会添加 <code>*/*</code> MIME 类型以涵盖各种情况。这通常用于通过浏览器的地址栏或HTML {{HTMLElement("a")}} 标签发起的请求。</p>

<table class="standard-table">
 <tbody>
  <tr>
   <th>User Agent</th>
   <th> Value</th>
   <th> Comment</th>
  </tr>
  <tr>
   <td>Firefox</td>
   <td><code>text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</code><br>
     </td>
   <td><code>这个值可以通过<a class="external" href="http://kb.mozillazine.org/Network.http.accept.default" title="http://kb.mozillazine.org/Network.http.accept.default">network.http.accept.default</a></code> 参数来修改。</td>
  </tr>
  <tr>
   <td>Safari, Chrome</td>
   <td>
    <p><code>application/xml,application/xhtml+xml,text/html;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5</code></p>
   </td>
   <td><a class="external" href="http://www.newmediacampaigns.com/page/browser-rest-http-accept-headers" title="http://www.newmediacampaigns.com/page/browser-rest-http-accept-headers"><span style="font-size: x-small;">source</span></a></td>
  </tr>
  <tr>
   <td>Safari 5</td>
   <td>
    <p><code>text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</code></p>
   </td>
   <td>这是对早期 <code>Accept</code> 头的改进,不再把 <code>image/png</code> 排在 <code>text/html</code> 之前。</td>
  </tr>
  <tr>
   <td>Internet Explorer 8</td>
   <td><code>image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/x-shockwave-flash, application/msword, */*</code></td>
   <td> 请参见 <a class="external" href="http://blogs.msdn.com/b/ieinternals/archive/2009/07/01/ie-and-the-accept-header.aspx" title="http://blogs.msdn.com/b/ieinternals/archive/2009/07/01/ie-and-the-accept-header.aspx">IE and the Accept Header (IEInternals' MSDN blog)</a>.</td>
  </tr>
  <tr>
   <td>Edge</td>
   <td><font face="Consolas, Liberation Mono, Courier, monospace">text/html, application/xhtml+xml, image/jxr, */*</font></td>
   <td> </td>
  </tr>
  <tr>
   <td>Opera</td>
   <td><code>text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1</code></td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="image请求">image请求</h2>

<p>当请求一张图片时, 比如一个 HTML {{HTMLElement("img")}} 元素, 用户代理通常会设置一个特定的媒体类型列表。</p>

<table class="standard-table">
 <tbody>
  <tr>
   <th>User Agent</th>
   <th>Value</th>
   <th>Comment</th>
  </tr>
  <tr>
   <td>Firefox</td>
   <td><code>*/*</code> (since Firefox 47)<br>
    <code>image/png,image/*;q=0.8,*/*;q=0.5</code> (before)</td>
   <td> 这个值可以通过 <code>image.http.accept</code> 参数修改。</td>
  </tr>
  <tr>
   <td>Safari</td>
   <td><code>*/*</code></td>
   <td> </td>
  </tr>
  <tr>
   <td>Chrome</td>
   <td><code>image/webp,image/*,*/*;q=0.8</code></td>
   <td> 在支持webp格式之前,是使用的 <code>*/*</code></td>
  </tr>
  <tr>
   <td>Internet Explorer 8 及更早版本</td>
   <td><code>*/*</code></td>
   <td> 请参见 <a class="external" href="http://blogs.msdn.com/b/ieinternals/archive/2009/07/01/ie-and-the-accept-header.aspx" title="http://blogs.msdn.com/b/ieinternals/archive/2009/07/01/ie-and-the-accept-header.aspx">IE and the Accept Header (IEInternals' MSDN blog)</a></td>
  </tr>
  <tr>
   <td>Internet Explorer 9</td>
   <td><code>image/png,image/svg+xml,image/*;q=0.8, */*;q=0.5</code></td>
   <td>请参见 <a class="external" href="http://blogs.msdn.com/b/fiddler/archive/2011/02/10/fiddler-is-better-with-internet-explorer-9.aspx" title="http://blogs.msdn.com/b/fiddler/archive/2011/02/10/fiddler-is-better-with-internet-explorer-9.aspx">Fiddler is better with Internet Explorer 9 (IEInternals' MSDN blog)</a></td>
  </tr>
 </tbody>
</table>

<h2 id="video请求">video请求</h2>

<p>通过HTML {{HTMLElement("video")}} 元素请求一个video时, 大多数浏览器会使用特定值。</p>

<table class="standard-table">
 <tbody>
  <tr>
   <th>User Agent</th>
   <th>Value</th>
   <th>Comment</th>
  </tr>
  <tr>
   <td>Firefox  3.6 之前的版本</td>
   <td><em> 不支持 {{HTMLElement("video")}}</em></td>
   <td> </td>
  </tr>
  <tr>
   <td>Firefox 3.6 及以上版本</td>
   <td><code>audio/webm, audio/ogg, audio/wav, audio/*;q=0.9, application/ogg;q=0.7, video/*;q=0.6; */*;q=0.5</code></td>
   <td> 请参见<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=489071" title="https://bugzilla.mozilla.org/show_bug.cgi?id=489071">bug 489071</a></td>
  </tr>
  <tr>
   <td>Chrome</td>
   <td><code>*/*</code></td>
   <td> </td>
  </tr>
  <tr>
   <td>Internet Explorer 8 或更早的版本</td>
   <td><em> 不支持 {{HTMLElement("video")}}</em></td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="audio请求">audio请求</h2>

<p>通过HTML {{HTMLElement("audio")}} 元素请求audio资源时, 大多数浏览器会使用特定值。</p>

<table class="standard-table">
 <tbody>
  <tr>
   <th>User Agent</th>
   <th>Value</th>
   <th>Comment</th>
  </tr>
  <tr>
   <td>Firefox 3.6 及以上版本</td>
   <td><code>audio/webm,audio/ogg,audio/wav,audio/*;q=0.9,application/ogg;q=0.7,video/*;q=0.6,*/*;q=0.5</code></td>
   <td>See <a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=489071" title="https://bugzilla.mozilla.org/show_bug.cgi?id=489071">bug 489071</a></td>
  </tr>
  <tr>
   <td>Safari, Chrome</td>
   <td>?</td>
   <td> </td>
  </tr>
  <tr>
   <td>Internet Explorer 8 及更早版本</td>
   <td><em> 不支持 {{HTMLElement("audio")}}</em></td>
   <td> </td>
  </tr>
  <tr>
   <td>Internet Explorer 9</td>
   <td>?</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="scripts请求">scripts请求</h2>

<p>当通过 {{HTMLElement("script")}} 元素请求script时, 一些浏览器使用特定值。</p>

<table class="standard-table">
 <tbody>
  <tr>
   <th>User Agent</th>
   <th>Value</th>
   <th>Comment</th>
  </tr>
  <tr>
   <td>Firefox</td>
   <td><code>*/*</code></td>
   <td> 请参见<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=170789" title="https://bugzilla.mozilla.org/show_bug.cgi?id=170789">bug 170789</a></td>
  </tr>
  <tr>
   <td>Safari, Chrome</td>
   <td><code>*/*</code></td>
   <td> </td>
  </tr>
  <tr>
   <td>Internet Explorer 8 及更早版本</td>
   <td><code>*/*</code></td>
   <td>请参见 <a class="external" href="http://blogs.msdn.com/b/ieinternals/archive/2009/07/01/ie-and-the-accept-header.aspx" title="http://blogs.msdn.com/b/ieinternals/archive/2009/07/01/ie-and-the-accept-header.aspx">IE and the Accept Header (IEInternals' MSDN blog)</a></td>
  </tr>
  <tr>
   <td>Internet Explorer 9</td>
   <td><code>application/javascript, */*;q=0.8</code></td>
   <td>请参见 <a class="external" href="http://blogs.msdn.com/b/fiddler/archive/2011/02/10/fiddler-is-better-with-internet-explorer-9.aspx" title="http://blogs.msdn.com/b/fiddler/archive/2011/02/10/fiddler-is-better-with-internet-explorer-9.aspx">Fiddler is better with Internet Explorer 9 (IEInternals' MSDN blog)</a></td>
  </tr>
 </tbody>
</table>

<h2 id="CSS_请求">CSS 请求</h2>

<p>当通过 <code>&lt;link rel="stylesheet"&gt;</code> HTML 元素请求CSS样式表时, 大多数浏览器使用特定值。</p>

<table class="standard-table">
 <tbody>
  <tr>
   <th>User Agent</th>
   <th>Value</th>
   <th>Comment</th>
  </tr>
  <tr>
   <td>Firefox 4</td>
   <td><code>text/css,*/*;q=0.1</code></td>
   <td> 请参见<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=170789" title="https://bugzilla.mozilla.org/show_bug.cgi?id=170789">bug 170789</a></td>
  </tr>
  <tr>
   <td>Safari 5</td>
   <td><code>text/css,*/*;q=0.1</code></td>
   <td> </td>
  </tr>
  <tr>
   <td>Internet Explorer 8 及更早版本</td>
   <td><code>*/*</code></td>
   <td>请参见 <a class="external" href="http://blogs.msdn.com/b/ieinternals/archive/2009/07/01/ie-and-the-accept-header.aspx" title="http://blogs.msdn.com/b/ieinternals/archive/2009/07/01/ie-and-the-accept-header.aspx">IE and the Accept Header (IEInternals' MSDN blog)</a></td>
  </tr>
  <tr>
   <td>Internet Explorer 9</td>
   <td><code>text/css</code></td>
   <td>请参见 <a class="external" href="http://blogs.msdn.com/b/fiddler/archive/2011/02/10/fiddler-is-better-with-internet-explorer-9.aspx" title="http://blogs.msdn.com/b/fiddler/archive/2011/02/10/fiddler-is-better-with-internet-explorer-9.aspx">Fiddler is better with Internet Explorer 9 (IEInternals' MSDN blog)</a></td>
  </tr>
  <tr>
   <td>Chrome 12</td>
   <td><code>text/css,*/*;q=0.1</code></td>
   <td> </td>
  </tr>
  <tr>
   <td>Opera 11.10</td>
   <td><code>text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1 </code></td>
   <td> </td>
  </tr>
  <tr>
   <td>Konqueror 4.6</td>
   <td><code>text/css,*/*;q=0.1</code></td>
   <td> </td>
  </tr>
 </tbody>
</table>