Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the meaning of "q=0.9,*/*;q=0.8"

Tags:

i am studying http protocol. when i use fiddler to catch a request, i find some arguments special.

part of http request:

Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryiUs1bDxxBwTvwCxS
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,\*/\*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: zh-CN,zh;q=0.8
Accept-Charset: GBK,utf-8;q=0.7,*;q=0.3

What does the arguments q=0.9,\*/\*;q=0.8 in the Accept-header, q=0.8 in the Accept-Language-header and q=0.7,*;q=0.3 in the Accept-Charset-header mean?

like image 797
Maperheal Avatar asked Feb 08 '13 00:02

Maperheal


Video Answer


2 Answers

Excerpt from this page http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html:

Note: Use of the "q" parameter name to separate media type parameters from Accept extension parameters is due to historical practice. Although this prevents any media type parameter named "q" from being used with a media range, such an event is believed to be unlikely given the lack of any "q" parameters in the IANA media type registry and the rare usage of any media type parameters in Accept. Future media types are discouraged from registering any parameter named "q".

This is basically a way to give the browser a way to indicate preference for a certain media type.

like image 166
Fred Thomsen Avatar answered Sep 22 '22 18:09

Fred Thomsen


I think

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language

has better explanation to the question.

Quote from the website:

Accept-Language: en-US,en;q=0.5

;q= (q-factor weighting)

Any value placed in an order of preference expressed using a relative quality value called weight.

like image 32
KamalDeep Avatar answered Sep 20 '22 18:09

KamalDeep