Example

We will use the following HTML for the examples listed below.

Syntax

If you are interested in retrieving all response headers, use the getAllResponseHeaders() method. If you only need access to a particular header, use the getResponseHeader(header) method and replace the ‘header’ variable with the name of the header you are interested in retrieving. Here are some examples:

XMLHTTPRequest Response Header Methods

getAllResponseHeaders()

getResponseHeader(header)