HTML5 localStorage

by Shanid

HTML

<div id="output"></div>

JavaScript

// Set the value in localStorage
localStorage.setItem("firstname", "Shanid");

// get the value from localStorage
var fname = localStorage.getItem("firstname");
document.getElementById("output").innerHTML = fname;