Local Storage in HTML5


/ Published in: JavaScript
Save to your folder(s)

This is just a simple explanation of how to use the HTML5 local storage in javascript. The link has a more thorough explanation and an example for those interested. The examples to save, retrive, and clear are marked below.


Copy this code and paste it in your HTML
  1. //Store "something" to the local storage under the name "stored_item".
  2. localStorage["something"]="stored_item";
  3.  
  4. // Get "item" from the localStorage item "something";
  5. var stored_item = localStorage["something"];
  6.  
  7. // Clear the local storage variable "something"
  8. localStorage.removeItem("something")

URL: http://fatfolderdesign.com/295/html5/making-offline-sitesapplications

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.