Though there are many ways to handle this situation, I recently had to try the same and ended up using localStorage and it really helped to handle data at various levels of requirements.
Getting to use it is so easy and simple. Just make sure you have HTML5 for schema validation and rest is swift.
When setting up the value, this is what needs to be done :
<script>
localStorage.setItem("firsttest", "Hello user...");
</script>
When retrieving the value, just do it as below..
<script>
var testvalue = localStorage.getItem("firsttest");
</script>
On a quick note, lets see what is localStorage.
localStorage - These are nothing but Web Storages, replacing the need to use cookies. Web storages are faster and can accomodate up to 5MB of data. If you want to store / retrieve data based on sessions, then the above can be replaced to use sessionStorage instead of localStorage.
Happy coding....
Friday, March 28, 2014
Subscribe to:
Posts (Atom)