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
q=%f是什么意思?
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
q=%f是什么意思?
当前回答
Accept-languages质量参数可以这样理解:
通过将Accept-Language: pl_PL;q=0.8, en_US;q=0.2,头附加到我们与服务器通信的请求下面的消息
服务器,请为我提供这个网站的波兰语翻译,但只有在其质量为>= %80%的相关质量因素。如果质量低于80% -我不介意得到英文版本,因为这与我无关,因为我说英语。
So for example, as a web page content provider we might introduce Accept-Language header parsing in such a way, that our website is suitable for foreigners speaking no English at all (then even translated navigation would be helpful (pages having translated only the navigation, lets say, have q=0.1), where fully translated content has q=0.9 and fully translated content and verified by native speakers speaking both original language and translated language content might have q=0.99 - because this is the only possible situation when meaning of the content is fully transduced)
其他回答
在规范中称为相对质量因子:
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."
参见:
HTTP/1.1:报头字段定义
Accept-languages质量参数可以这样理解:
通过将Accept-Language: pl_PL;q=0.8, en_US;q=0.2,头附加到我们与服务器通信的请求下面的消息
服务器,请为我提供这个网站的波兰语翻译,但只有在其质量为>= %80%的相关质量因素。如果质量低于80% -我不介意得到英文版本,因为这与我无关,因为我说英语。
So for example, as a web page content provider we might introduce Accept-Language header parsing in such a way, that our website is suitable for foreigners speaking no English at all (then even translated navigation would be helpful (pages having translated only the navigation, lets say, have q=0.1), where fully translated content has q=0.9 and fully translated content and verified by native speakers speaking both original language and translated language content might have q=0.99 - because this is the only possible situation when meaning of the content is fully transduced)
这被称为相对质量因子。它指定了用户更喜欢的语言,范围从0到1,可以从HTTP/1.1规范§14.4中看到:
每个语言范围可以被赋予一个相关的质量值,该质量值表示用户对该范围所指定的语言的偏好的估计。质量值默认为“q=1”。例如, Accept-Language: da, en-gb;q=0.8, en 的意思是:“我更喜欢丹麦语,但也接受英式英语和其他类型的英语。”