Fix: polyfill localStorage and sessionStorage
This commit is contained in:
parent
a76d28daf5
commit
001a212f24
|
@ -50,4 +50,22 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
if (!localStorage) {
|
||||||
|
throw new Error('localStorage is null');
|
||||||
|
}
|
||||||
|
localStorage._access_check = 1;
|
||||||
|
delete localStorage._access_check;
|
||||||
|
} catch (err) {
|
||||||
|
Object.defineProperty(self, 'localStorage', {value: {}});
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (!sessionStorage) {
|
||||||
|
throw new Error('sessionStorage is null');
|
||||||
|
}
|
||||||
|
sessionStorage._access_check = 1;
|
||||||
|
delete sessionStorage._access_check;
|
||||||
|
} catch (err) {
|
||||||
|
Object.defineProperty(self, 'sessionStorage', {value: {}});
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user