There may be multiple pages of the same content on the same Web site. For example, the English and Chinese version of the Web page, they are the same content, but the use of language is different. When the browser's default language is English or Chinese, web pages with the same URL are displayed in the English or Chinese version. Such a mechanism is called content negotiation (negotiation).
The content negotiation mechanism refers to the client and server to negotiate the content of the response, and then provides the most suitable resources for the client. Content negotiation is a benchmark for judging the language , character set , encoding , etc. of the resource in response .
Some of the header fields included in the request message (below) are the benchmarks of the judgments (the detailed descriptions of these header fields are explained later):
Accept
Accept-charset
Accept-encoding
Accept-language
Content-language
The following 3 types of content negotiation technologies are available:
Server-driven negotiation (Server-driven negotiation): Content negotiation by the server side. The requested header field is referenced and processed automatically on the server side. But for users, the information sent by the browser as the basis for decision, and not necessarily be able to sift out the best content.
client-side driver negotiation (Agent-driven negotiation): How content is negotiated by the client. The user selects manually from the list of selectable options displayed in the browser. You can also use JavaScript scripts to automatically make these choices on a Web page. For example, by the type of OS or browser type, you switch to the PC version of the page or mobile version of the page.
Transparent Negotiation (Transparent negotiation): A combination of server-driven and client-driven, which is a way for the server-side and client to negotiate content on their own.
Content negotiation of HTTP messages within HTTP messages returns the most appropriate content