Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!

The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able to understand. Using content negotiation, the server then selects one of the proposals, uses it and informs the client of its choice with the Content-Type response header. Browsers set adequate values for this header depending of the context where the request is done: when fetching a CSS stylesheet a different value is set for the request than when fetching an image, video or a script.

Header type Request header
Forbidden header name no
CORS-safelisted request-header yes

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, */*;q=0.8

Directives

<MIME_type>/<MIME_subtype>
A single, precise MIME type, like text/html.
<MIME_type>/*
A MIME type, but without any subtype. image/* will match image/png, image/svg, image/gif and any other image types.
*/*
Any MIME type
;q= (q-factor weighting)
Any value used is placed in an order of preference expressed using relative quality value called the weight.

Examples

Accept: text/html

Accept: image/*

Accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8

Specifications

Specification Title
RFC 7231, section 5.3.2: Accept Hypertext Transfer Protocol (HTTP/1.1): Semantics and Context

Browser compatibility

Feature Chrome Edge Firefox Internet Explorer Opera Safari Servo
Basic Support(Yes)(Yes)(Yes)(Yes)(Yes)(Yes)(Yes)
Feature Android Chrome for Android Edge Mobile Firefox for Android IE Mobile Opera Mobile Safari Mobile
Basic Support(Yes)(Yes)(Yes)(Yes)(Yes)(Yes)(Yes)

See also

ドキュメントのタグと貢献者

 このページの貢献者: fscholz, deadtrickster, MrJadaml, teoli
 最終更新者: fscholz,