HTML5-Session Storage Example

Definition :

     Session storage hold the data still the end of user session storage.

Program :




                   function display()


                    if(typeof(Storage)!=”undefined”) {

                                if(sessionStorage.clickCount) {


                                } else {



                                document.getElementById(“result”).innerHTML=you have clicked the button”+sessionStorage.clickCount+”time(s) in this session.”;

                                } else {

                                document.getElementById(“result”).innerHTML=”sorry, your browser does not support web storage…”;





                                  <button onClick=”display()”> click me </button>

                                  <div id=”result”> </div>



Leave a Reply

Your email address will not be published. Required fields are marked *