-
-
Save svieira/726943 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!sessionStorage && JSON) { | |
sessionStorage = (function () { | |
var data = window.name ? JSON.parse(window.name) : {}; | |
return { | |
clear: function () { | |
data = {}; | |
window.name = ''; | |
}, | |
getItem: function (key) { | |
return data[key] === undefined ? null : data[key]; | |
}, | |
removeItem: function (key) { | |
delete data[key]; | |
window.name = JSON.stringify(data); | |
}, | |
setItem: function (key, value) { | |
data[key] = value; | |
window.name = JSON.stringify(data); | |
} | |
}; | |
})(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment