代码示例:(标识:eg_js_ajax_getresponseheader)
<!DOCTYPE html>
<html>
<body>

<h1>XMLHttpRequest 对象</h1>

<p>getResponseHeader() 函数返回资源的特定头信息,如长度,服务器类型,内容类型,最后修改等:</p>

<p>最后修改时间:<span id="demo"></span></p>

<script>
var xhttp=new XMLHttpRequest();
xhttp.onreadystatechange = function() {
  if (this.readyState == 4 && this.status == 200) {
    document.getElementById("demo").innerHTML =
    this.getResponseHeader("Last-Modified");
  }
};
xhttp.open("GET", "/static/demo/txt/ajax_info.txt", true);
xhttp.send();
</script>

</body>
</html>
运行结果: