Store.js is a localstorage wrapper that is compatible with all browsers, without the use of cookies or Flash. Store.js will automatically choose to use Localstorage, Globalstorage, or userData to implement local storage capabilities according to the browser.
Store.js provides a very concise API to enable Cross-browser local storage capabilities:?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17-18 |
Store.set (' username ', ' Marcus ') Store.get (' username ') store.remove (' username ') store.clear () store.set ("User ', {name: ' Marcus ', Likes: ' JavaScript '} ' var user = Store.get (' user ') alert (user.name + ' likes ' + user.likes) Get all stored values Store.getall (). User.Name = = ' Marcus '//Loop over all stored values Store.foreach (function (Key, Val) {Console.log (key, ' = = ', val)}) |
Supported Browsers:Tested in iOS 4 tested in iOS 5 tested in iOS 6 tested in Firefox 3.5 tested in Firefox 3.6 tested in Firefox 4.0+ Support Dropped for Firefox < 3.5 (and notes below) tested in Chrome 5 tested in Chrome 6 tested in Chrome 7 tested in Chrome 8 tested in chrome tested in chrome 11+ tested in Safari 4 tested in Safari 5 tested in IE6 tested in IE7 tested in IE8 Tested in IE9 tested in IE10 tested in opera tested in opera one tested in opera one tested in Node.js v0.10.4 (with HTT Ps://github.com/coolaj86/node-localstorage 1.0.2)