Path: blob/main/files/en-us/web/http/headers/accept/index.md
6532 views
------{{HTTPSidebar}}
The Accept request HTTP header indicates which content types, expressed as MIME types, the client is able to understand. The server uses content negotiation to select one of the proposals and informs the client of the choice with the {{HTTPHeader("Content-Type")}} response header. Browsers set required values for this header based on the context of the request. For example, a browser uses different values in a request when fetching a CSS stylesheet, image, video, or a script.
| Header type | {{Glossary("Request header")}} |
|---|---|
| {{Glossary("Forbidden header name")}} | no |
| {{Glossary("CORS-safelisted request header")}} |
yes, with the additional restriction that values can't contain a
CORS-unsafe request header byte: 0x00-0x1F (except 0x09 (HT)),
"():<>?@[\]{}, and 0x7F (DEL).
|
Syntax
Directives
<MIME_type>/<MIME_subtype>: A single, precise MIME type, like
text/html.
<MIME_type>/*: A MIME type, but without a subtype.
image/*corresponds toimage/png,image/svg,image/gif, and other image types.
*/*: Any MIME type
;q=(q-factor weighting): A value used is placed in an order of preference expressed using a relative quality value called the weight.
Examples
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
HTTP content negotiation
A header with the result of the content negotiation: {{HTTPHeader("Content-Type")}}
Other similar headers: {{HTTPHeader("TE")}}, {{HTTPHeader("Accept-Encoding")}}, {{HTTPHeader("Accept-Language")}}