Which is the Best Java Web Framework ?

Javascript - Session Storage


Session Storage is an alternative to storing information in a cookie so that session information can be maintained using javascript.

//save a value
sessionStorage.setItem("name", "Nicholas");

//retrieve item
var name = sessionStorage.getItem("name");

//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;
 
Here is the example in which we are checking that if there are values in the Session Storage , first load the arrays with those values.

if (sessionStorage.length != 0){
    for(i=0;i<=90;i++){
         if(sessionStorage.getItem(i) != null) {
            array.push(i);
        }
}

Related Link

http://techsharepoint.blogspot.com/2012/11/javascript-tambola-board-source-code.html
Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
comments powered by Disqus




×

Try our new Java Interview Questions Search Tool.

There are more than 1000 questions with practice tests.

It's updated daily and It's Awesome.


×

Try our new Java Practice Test tool.

There are more than 200 questions and expanding quickly. It's updated daily and It's Awesome.