$.ajax HEAD Request Just To Get Response Headers Of Same page

$.ajax(document.location.href,{type:'HEAD'}).done(function(data,status,xhr){
  var result = "<table><tr><th>Header Name</th><th>Header Value</th></tr>" + "<tr><td>" + xhr.getAllResponseHeaders()
  .replace("\r","") //normalize line-breaks
  .replace(/\n$/,"") //remove extra line-break at the end
  .split("\n").join("</td></tr>\n<tr><td>") //table rows
  .split(": ").join("</td><td>") //table columns
  + "</td></tr></table>"


  console.log(result);

});

it works well if your headers values do not include any :{SPACE}