Accept
Accept
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 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 fetches a CSS stylesheet, image, video, or a script.
Header type | Request header |
---|---|
Forbidden header name | no |
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
Accept: <MIME_type>/<MIME_subtype> Accept: <MIME_type>/* Accept: */* // Multiple types, weighted with the quality value syntax: Accept: text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, */*;q=0.8
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
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
Specifications
Specification |
---|
Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content (HTTP/1.1) # header.accept |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
Accept |
Yes |
12 |
Yes
In Firefox 66, the default
Accept header value changed to */* . |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes
In Firefox 66, the default
Accept header value changed to */* . |
Yes |
Yes |
Yes |
See also
- HTTP content negotiation
- List of default Accept values
- A header with the result of the content negotiation:
Content-Type
- Other similar headers:
TE
,Accept-Encoding
,Accept-Language
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept