只需直接使用XHR。这个例子取自MDN:
var oReq = new XMLHttpRequest();oReq.open("GET", "/myfile.png", true);oReq.responseType = "arraybuffer";oReq.onload = function(oEvent) { var arrayBuffer = oReq.response; // if you want to access the bytes: var byteArray = new Uint8Array(arrayBuffer); // ... // If you want to use the image in your DOM: var blob = new Blob([arrayBuffer], {type: "image/png"}); var url = URL.createObjectURL(blob); someImageElement.src = url; // whatever...};oReq.send();


