Using XMLHTTPRequest, I am trying to access the content-length reponse header for a .pdf file, however it's not being returned. If I do the same for a .jpg file then content-length is returned, so I at least know that my code is working. Unfortunately, I need it for PDFs specifically.
Below is a partial code snippet that I'm using for debugging purposes that returns all header info, so I can see what all IS being returned. Again, for .jpg files I see Content-Length, but not for .pdf files.
Any ideas why this would be the case? Is there a way to ensure that content-length is returned for PDFs?
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if (xhr.readyState === 4) {
alert(xhr.getAllResponseHeaders());
}
};
xhr.open("HEAD", url, true);
xhr.send();
Thanks