What is q=0.5 in Accept* HTTP headers?

前端 未结 3 1803
我寻月下人不归
我寻月下人不归 2020-11-28 20:18
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
3条回答
  •  时光取名叫无心
    2020-11-28 21:13

    It is called the relative quality factor in the specification:

    Each media-range MAY be followed by one or more accept-params, beginning with the "q" parameter for indicating a relative quality factor. The first "q" parameter (if any) separates the media-range parameter(s) from the accept-params. Quality factors allow the user or user agent to indicate the relative degree of preference for that media-range, using the qvalue scale from 0 to 1 (section 3.9). The default value is q=1.

    ...

    The example

    Accept: audio/*; q=0.2, audio/basic
    

    SHOULD be interpreted as "I prefer audio/basic, but send me any audio type if it is the best available after an 80% mark-down in quality."

    See also:

    • HTTP/1.1: Header Field Definitions

提交回复
热议问题