From 6efd2a21c4ae49e670927534700ac5332f027a78 Mon Sep 17 00:00:00 2001 From: Administrator <363012115@qq.com> Date: Tue, 8 Aug 2017 15:55:36 +0800 Subject: [PATCH] fix the problem of loading local resources failed when the protocol is 'file://' --- CCBoot.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CCBoot.js b/CCBoot.js index 06ec6e67df..8f4bafd3cd 100644 --- a/CCBoot.js +++ b/CCBoot.js @@ -797,7 +797,7 @@ cc.loader = (function () { xhr.setRequestHeader("Accept-Charset", "utf-8"); xhr.onreadystatechange = function () { if (xhr.readyState === 4) - xhr.status === 200 ? cb(null, xhr.responseText) : cb({status:xhr.status, errorMessage:errInfo}, null); + (xhr.status === 200||xhr.status === 0) ? cb(null, xhr.responseText) : cb({status:xhr.status, errorMessage:errInfo}, null); }; } else { if (xhr.overrideMimeType) xhr.overrideMimeType("text\/plain; charset=utf-8"); @@ -806,7 +806,7 @@ cc.loader = (function () { clearTimeout(xhr._timeoutId); } if (xhr.readyState === 4) { - xhr.status === 200 ? cb(null, xhr.responseText) : cb({status:xhr.status, errorMessage:errInfo}, null); + (xhr.status === 200||xhr.status === 0) ? cb(null, xhr.responseText) : cb({status:xhr.status, errorMessage:errInfo}, null); } }; xhr.onerror = function () { @@ -845,7 +845,7 @@ cc.loader = (function () { window.msg = arrayBuffer; } if (xhr.readyState === 4) { - xhr.status === 200 ? cb(null, xhr.response) : cb({status:xhr.status, errorMessage:errInfo}, null); + (xhr.status === 200||xhr.status === 0) ? cb(null, xhr.response) : cb({status:xhr.status, errorMessage:errInfo}, null); } }; xhr.onerror = function(){