Bug fix for some browsers with Private (or Incognito) Mode turned on #10

Open
wants to merge 1 commit into
from
View
@@ -36,7 +36,16 @@
// Allow the user to explicitly turn off localStorage
// before loading this plugin
if (typeof $.support.localStorage === "undefined") {
- $.support.localStorage = !!window.localStorage;
+ var localStorageTest = function() {
+ try {
+ localStorage.setItem("test", "test");
+ localStorage.removeItem("test");
+ return true;
+ } catch(e) {
+ return false;
+ }
+ };
+ $.support.localStorage = !!window.localStorage && localStorageTest();
}
// modified getJSON which uses ifModified: true
@@ -162,6 +171,7 @@
"NS_ERROR_DOM_QUOTA_REACHED") {
cleanupLocalStorage();
}
+ break;
}
}