This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

getAllResponseHeaders

Summary

Returns all the response headers as a string, or null if no response has been received.

Method of apis/xhr/XMLHttpRequestapis/xhr/XMLHttpRequest

Syntax

var  = object.getAllResponseHeaders();

Return Value

Returns an object of type StringString

Examples

var xhr = new XMLHttpRequest();
xhr.open("GET", "http://localhost/test.xml", true);
xhr.send();

var headers = xhr.getAllResponseHeaders().toLowerCase();
alert(headers);

Notes

Each name/value pair in the returned string is delimited by a carriage return/line feed (CR/LF) sequence.

Related specifications

W3C XMLHttpRequest Specification
W3C Working Draft

Attributions