Skip to content

Instantly share code, notes, and snippets.

@PhiLhoSoft
Created August 29, 2013 05:55
Show Gist options
  • Save PhiLhoSoft/6374649 to your computer and use it in GitHub Desktop.
Save PhiLhoSoft/6374649 to your computer and use it in GitHub Desktop.
Minor changes from the showheaders.js found at http://bgrins.github.io/devtools-snippets/ Discovering some nice features...
// showheaders.js
// Little changes (for Firebug) from https://github.com/bgrins/devtools-snippets
// Print out response headers for current URL.
(function()
{
var request = new XMLHttpRequest();
request.open('HEAD', window.location, false);
request.send(null);
var headers = request.getAllResponseHeaders();
var tab = headers.split("\r\n").map(function(h)
{
var hp = h.split(": ");
return { "Key": hp[0], "Value": hp[1] }
}).filter(function(h) { return h.Value !== undefined; });
console.group("Request Headers");
console.log(headers);
console.table(tab);
console.groupEnd("Request Headers");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment