Each HTTP request and response will have the appropriate header information. By default, the following header information is sent while the XHR request is sent:
Accept: Types of content that browsers can handle
Accept-charset: The character set that the browser can display
Accept-encoding: The compression code that the browser can handle
Accept-language: The language currently set by the browser
Connection: Type of connection between browser and server
Cookie: Any cookie for current page settings
Host: The domain in which the requested page is issued
Referer: URL of the page that issued the request
User-agent: User agent string for browser
Although different browsers actually send the header information differently, but the above list is basically the browser will send, with the setRequestHeader () method can also set the request header information, the function accepts two parameters: Header field name and header field value. To successfully send the request header information, it needs to be called before the Open method is called and before the Send method is called.
HTTP Response header information:
Date: Indicates when the message was sent, and the description format of the time is defined by rfc822
Server: Names of servers.
Connection: Type of connection between browser and server
Content-type: Indicates what MIME type the following document belongs to
Cache-control: Controlling HTTP Caching