test if localStorage is usable, fixes #2350
This commit is contained in:
parent
37f3ca1f47
commit
09af7fa1ac
1 changed files with 7 additions and 0 deletions
|
@ -117,7 +117,14 @@ Ox.localStorage = function(namespace) {
|
||||||
localStorage = window.localStorage || {};
|
localStorage = window.localStorage || {};
|
||||||
// FF 3.6 can't assign to or iterate over localStorage
|
// FF 3.6 can't assign to or iterate over localStorage
|
||||||
for (var key in localStorage) {};
|
for (var key in localStorage) {};
|
||||||
|
|
||||||
|
// In Safari (OS X or iOS) is in private browsing mode,
|
||||||
|
// it appears as though localStorage is available,
|
||||||
|
// but trying to call .setItem throws an exception.
|
||||||
|
localStorage.setItem("OxJS.writeTest", "");
|
||||||
|
localStorage.removeItem("OxJS.writeTest");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.log('localStorage disabled');
|
||||||
localStorage = {};
|
localStorage = {};
|
||||||
}
|
}
|
||||||
function storage(key, value) {
|
function storage(key, value) {
|
||||||
|
|
Loading…
Reference in a new issue