草庐IT

overrideMimeType

全部标签

javascript - 使用 XMLHttpRequest 下载二进制数据,无需 overrideMimeType

我正在尝试使用XMLHttpRequest在Javascript中检索图像数据。varxhr=newXMLHttpRequest();xhr.open("GET","http://www.celticfc.net/images/doc/celticcrest.png");xhr.onreadystatechange=function(){if(xhr.readyState===4){varresp=xhr.responseText;console.log(resp.charCodeAt(0)&0xff);}};xhr.send();此数据的第一个字节应为0x89,但是任何高值字节都返回