HOW TO STORE DATA ON CLIENT IN HTML5?

Chris Anderson

Total Post:197

Points:985
Posted by  Chris Anderson
HTML5 
 4028  View(s)
Ratings:
Rate this:
  1. Chris Anderson

    Post:197

    Points:985
    How to store data on client in HTML5?

    HTML5 offers two new objects for storing data on the client:

    LocalStorage - stores data with no time limit

    <script type="text/javascript">

    localStorage.lastname="Smith";
    document.write(localStorage.lastname);

    </script> 

     

    SessionStorage - stores data for one session.The data is deleted when the user closes the browser window.

    <script type="text/javascript">

    sessionStorage.lastname="Smith";
    document.write(sessionStorage.lastname);

    </script>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!