Skip to content

Instantly share code, notes, and snippets.

View skechboy's full-sized avatar
🔥
Selling fire in hell

Trajche Petrov skechboy

🔥
Selling fire in hell
View GitHub Profile
@skechboy
skechboy / localStorageFallback.js
Created June 10, 2011 18:20
localStorage Fallback
/* Checks if localStorage exists on the browser, if not, creates a JSONFallbackStorage object where all the data will be stored. Also creates the localStorage methods so you won't need to change anything on your script. Just remember to send the data on JSONFallbackStore to the server. */
(function(window, undefined){
if (typeof(localStorage) === undefined) {
JSONFallbackStore = {};
window.localStorage = {
getItem: function(key){
return JSONFallbackStore[key];
},
setItem: function(key, value){