Save data to local storage

You can use localStorage like this: // Retrieve your data from locaStorage var saveData = JSON.parse(localStorage.saveData || null) || {}; // Store your data. function saveStuff(obj) { saveData.obj = obj; // saveData.foo = foo; saveData.time = new Date().getTime(); localStorage.saveData = JSON.stringify(saveData); } // Do something with your data. function loadStuff() { return saveData.obj || “default”; … Read more

How to get the localStorage with Python and Selenium WebDriver

The python API doesn’t provide a way to directly read/write the local storage, but it can be done with execute_script. class LocalStorage: def __init__(self, driver) : self.driver = driver def __len__(self): return self.driver.execute_script(“return window.localStorage.length;”) def items(self) : return self.driver.execute_script( \ “var ls = window.localStorage, items = {}; ” \ “for (var i = 0, k; … Read more

Is there a way to increase the size of localStorage in Google Chrome to avoid QUOTA_EXCEEDED_ERR: DOM Exception 22

5MB is a hard limit and that is stupid. IndexedDB gives you ~50MB which is more reasonable. To make it easier to use try Dexie.js https://github.com/dfahlander/Dexie.js Update: Dexie.js was actually still an overkill for my simple key-value purposes so I wrote this much simpler script https://github.com/DVLP/localStorageDB with this you have 50MB and can get and … Read more

Phonegap iOS 5.1 and localStorage

There was a large thread in the phonegap group that talked about this problem. Basically its because they now treat localStorage as a temp item which can be deleted at any point. Never fear there are very smart people at work! here’s the thread – https://groups.google.com/forum/?fromgroups#!topic/phonegap/RJC2qA9sDnw here’s the code – http://pastebin.com/5881768B