Trick with localStorage
I've been using this trick more an more lately to store data permanently in the browser.
data = JSON.parse(localStorage.getItem('data')) || [];
data.push({
name: 'Andrei',
age: 20
});
localStorage.setItem('data', JSON.stringify(data));
I've found it to be very useful. It's localStorage so it's on mobile too!
Support (http://caniuse.com/#feat=namevalue-storage)
* android 2.1
* IE 8+
* everyone else
Written by Andrei Oprea
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Localstorage
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#