<!DOCTYPE html>
<html>
<body>

<p>The getAllResponseHeaders() function returns the header information of a resource, like length, server-type, content-type, last-modified, etc.</p>

<button onclick="loadXMLDoc('xmlhttp_info.txt')">Get header information</button>

<p id="demo"></p>

<script>
function loadXMLDoc(url) {
  var xmlhttp = new XMLHttpRequest();
  xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
      document.getElementById("demo").innerHTML =
      xmlhttp.getAllResponseHeaders();
    }
  };
  xmlhttp.open("GET", url, true);
  xmlhttp.send();
}
</script>

</body>
</html>