Monday, 30 June 2014

jQuery sessionStorage

if (sessionStorage.getItem("MySessionName") == null) {
//save a value
sessionStorage.setItem("MySessionName", "MySessionValue");
//retrieve item
var name = sessionStorage.getItem("MySessionName");
//get the key name for the first item
var key = sessionStorage.key(0);
//remove the key
sessionStorage.removeItem(key);
//check how many key-value pairs are present
var count = sessionStorage.length;
}