Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cocos2d/core/utils/BinaryLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ cc.loader.loadBinary = function (url, cb) {
var xhr = this.getXMLHttpRequest(),
errInfo = "load " + url + " failed!";
xhr.open("GET", url, true);
xhr.responseType = 'arraybuffer';
if (cc.loader.loadBinary._IEFilter) {
// IE-specific logic here
xhr.setRequestHeader("Accept-Charset", "x-user-defined");
Expand All @@ -49,7 +50,7 @@ cc.loader.loadBinary = function (url, cb) {
} else {
if (xhr.overrideMimeType) xhr.overrideMimeType("text\/plain; charset=x-user-defined");
xhr.onload = function () {
xhr.readyState === 4 && xhr.status === 200 ? cb(null, self._str2Uint8Array(xhr.responseText)) : cb(errInfo);
xhr.readyState === 4 && xhr.status === 200 ? cb(null, xhr.response) : cb(errInfo);
};
}
xhr.send(null);
Expand Down Expand Up @@ -80,6 +81,7 @@ cc.loader.loadBinarySync = function (url) {
req.timeout = 0;
var errInfo = "load " + url + " failed!";
req.open('GET', url, false);
req.responseType = 'arraybuffer';
var arrayInfo = null;
if (cc.loader.loadBinary._IEFilter) {
req.setRequestHeader("Accept-Charset", "x-user-defined");
Expand All @@ -102,7 +104,7 @@ cc.loader.loadBinarySync = function (url) {
return null;
}

arrayInfo = this._str2Uint8Array(req.responseText);
arrayInfo = req.response;
}
return arrayInfo;
};
Expand Down Expand Up @@ -151,4 +153,4 @@ if (cc.loader.loadBinary._IEFilter) {
return byteMapping[match];
}) + lastChr;
};
}
}