mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-21 02:23:30 +00:00
Work even if localStorage throws a SECURITY_ERR (fixes #772)
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
window.iD = function () {
|
||||
var context = {},
|
||||
storage = localStorage || {};
|
||||
storage;
|
||||
|
||||
// https://github.com/systemed/iD/issues/772
|
||||
// http://mathiasbynens.be/notes/localstorage-pattern#comment-9
|
||||
try { storage = localStorage } catch (e) {}
|
||||
storage = storage || {};
|
||||
|
||||
context.storage = function(k, v) {
|
||||
if (arguments.length === 1) return storage[k];
|
||||
|
||||
Reference in New Issue
Block a user