Web Site

Internet-description.com



» Internet » Topics begins with C » Content Negotiation


Page modified: Saturday, June 24, 2006 10:36:48

By content Negotiation one understands a mechanism in HTTP minutes, which makes a tuning possible of contents of the called document due to the possibilities and attitudes of the Clients. This possibility should be offered by an Internet side, must it however not.

One of furthest common applications is the automatic selection of the language. In addition the Client in its inquiry sends the field Accept LANGUAGE (in the example with the language German):

Accept LANGUAGE: de

The implementing server given with the fact admits that the user understands exclusively German. It has thus the possibility of sending the German version of the side of passing the user on on a special side or - further spread -.

Accept LANGUAGE: de; q=1.0, EN; q=0.5, fr; q=0.2 Accept: text/HTML; q=1.0, text/*; q=0.8, image/GIF; q=0.6, image/JPEG; q=0.6, image/*; q=0.5, */*; q=0.1

As this more complex inquiry the Client indicates that it understands German, English and French, whereby it can do German best, English secondarybest and French only little. In the second line it is indicated that he receives its documents at the dearest in the type of MIME text/HTML (HTML), in addition, other texts to indicate can. With pictures the formats GIF and JPEG are preferred, in addition, all different can be indicated. The last block (off */*) indicates that also all other files are accepted. This indicates the Browser usually however not, but offers to it to store.

In the connection with it a further application, it exists lies in sending different versions of a picture. If a Browser can indicate for example only pictures in the GIF format, not however in the png format, then the server can send the preferential picture version to the user.

HTTP status code

The HTTP offers to status codes, which the server at the Client should send, depending on whether a contentwise tuning was possible or not:

300 multiple Choices
Sent if the document under the appropriate conditions in other place to find is. The appropriate address must in the location header be along-sent and should also in the Body be again indicated.
406 emergency Acceptable
Sent if the called document one exists, which do not apply from the Client sent conditions however.

Apache

The Apache HTTP server offers the possibility several languages to the offerer to offer, without having to program something. In addition the offerer must attach only the ISO-639-Kennung of the respective language at the file names.

This form of the contents tuning rather rarely used, not least because is very strict and for example "„de "“(German) is not used it, if the user indicated more in detail that he prefers "„de-CH "“(Swiss-German).

Related links


Related Websites

We found here 6 related websites.

Page cached: Wednesday, July 5, 2006 23:53:31
Valid XHTML 1.0!  Valid CSS!

Page copy protected against web site content infringement by Copyscape