Skip to content

Commit 6efd2a2

Browse files
committed
fix the problem of loading local resources failed when the protocol is 'file://'
1 parent 0a707e9 commit 6efd2a2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

CCBoot.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ cc.loader = (function () {
797797
xhr.setRequestHeader("Accept-Charset", "utf-8");
798798
xhr.onreadystatechange = function () {
799799
if (xhr.readyState === 4)
800-
xhr.status === 200 ? cb(null, xhr.responseText) : cb({status:xhr.status, errorMessage:errInfo}, null);
800+
(xhr.status === 200||xhr.status === 0) ? cb(null, xhr.responseText) : cb({status:xhr.status, errorMessage:errInfo}, null);
801801
};
802802
} else {
803803
if (xhr.overrideMimeType) xhr.overrideMimeType("text\/plain; charset=utf-8");
@@ -806,7 +806,7 @@ cc.loader = (function () {
806806
clearTimeout(xhr._timeoutId);
807807
}
808808
if (xhr.readyState === 4) {
809-
xhr.status === 200 ? cb(null, xhr.responseText) : cb({status:xhr.status, errorMessage:errInfo}, null);
809+
(xhr.status === 200||xhr.status === 0) ? cb(null, xhr.responseText) : cb({status:xhr.status, errorMessage:errInfo}, null);
810810
}
811811
};
812812
xhr.onerror = function () {
@@ -845,7 +845,7 @@ cc.loader = (function () {
845845
window.msg = arrayBuffer;
846846
}
847847
if (xhr.readyState === 4) {
848-
xhr.status === 200 ? cb(null, xhr.response) : cb({status:xhr.status, errorMessage:errInfo}, null);
848+
(xhr.status === 200||xhr.status === 0) ? cb(null, xhr.response) : cb({status:xhr.status, errorMessage:errInfo}, null);
849849
}
850850
};
851851
xhr.onerror = function(){

0 commit comments

Comments
 (0)