Why won't IE let me see the Content-Length header with getResponseHeader() ?
I know headers are being sent; I see them with Wireshark. IE just won't let me get them.
If the Content-Encoding header is not sent, regardless of whether the content is gzipped or not, I can get them just fine.
Code example:
function getXMLHttpRequest() { if (window.XMLHttpRequest) { return new window.XMLHttpRequest; } else { try { return new ActiveXObject("MSXML2.XMLHTTP.3.0"); } catch (ex) { return null; } } } function handler() { if (oReq.readyState == 4 /* complete */) { if (oReq.status == 200) { // this alert will be missing Content-Length // and Content-Encoding if Content-Encoding is sent. alert(oReq.getAllResponseHeaders()); } } } var oReq = getXMLHttpRequest(); if (oReq != null) { oReq.open("GET", "http://www.example.com/gzipped/content.js", true); oReq.onreadystatechange = handler; oReq.send(); } else { window.alert("AJAX (XMLHTTP) not supported."); }
source share