diff --git a/libs/core.js b/libs/core.js index fd87ab97..3c5a3446 100644 --- a/libs/core.js +++ b/libs/core.js @@ -232,6 +232,22 @@ core.prototype.init = function (coreData, callback) { core.platform.isQQ = /QQ/i.test(navigator.userAgent); core.platform.isWeChat = /MicroMessenger/i.test(navigator.userAgent); core.platform.useLocalForage = core.getLocalStorage('useLocalForage', true); + if (core.platform.useLocalForage) { + try { + core.setLocalForage("__test__", "__test__", function() { + try { + core.getLocalForage("__test__", null, function(data) { + if (data!="__test__") { + console.log("__test__ fail!"); + core.platform.useLocalForage=false; + } + }, function(e) {console.log(e); core.platform.useLocalForage=false;}) + } + catch (e) {console.log(e); core.platform.useLocalForage=false;} + }, function(e) {console.log(e); core.platform.useLocalForage=false;}) + } + catch (e) {console.log(e); core.platform.useLocalForage=false;} + } if (window.FileReader) { core.platform.fileReader = new FileReader(); @@ -273,7 +289,6 @@ core.prototype.init = function (coreData, callback) { core.material.ground.src = "project/images/ground.png"; core.bigmap.tempCanvas = document.createElement('canvas').getContext('2d'); - core.getLocalForage("test"); core.loader.load(function () { console.log(core.material);