If the actual size of the file is 6327 bytes (and the content length in the response header is 6327),
So why is the XMLHttpRequest response length different (the value of xhr.response.length in the code below):
6085 in Chrome (version 41) and 5961 in Firefox (version 36)?
// This code to avoid access error somewhere on google.com var xhr = new XMLHttpRequest (); Xhr.open ('receive', 'https: //www.google.com/images/errors/robot.png',true); Xhr.onreadystatechange = function (e) {if (xhr.readyState == 4 & xhr.status == 200} {console.log (xhr.response.length); }}; Xhr.send ();
command
xhr.setRequestHeader ('content-type', 'image / PNG');
or command
xhr.setRequestHeader ('content-type', 'app / zip');
does not help.
No comments:
Post a Comment