HTML5 provides two new ways to store data on the client:
Localstorage-Data storage with no time limit
Sessionstorage-Data storage for a session
Previously, these were all done by cookies. However, cookies are not suitable for storing large amounts of data because they are passed by each request to the server, which makes the cookie slow and inefficient.
Localstorage method
The data stored by the Localstorage method has no time limit. Data is still available after the second, second, or next year.
<script type= "Text/javascript" >
Localstorage.lastname= "Smith";
document.write (Localstorage.lastname);
</script>
Sessionstorage method
The Sessionstorage method stores data for a session
。 When the user closes the browser window, the data is deleted.
<script type= "Text/javascript" >
Sessionstorage.lastname= "Smith";
document.write (Sessionstorage.lastname);
</script>
Sessionstorag? Method:
Getltem Setletm Removeltem key (no parameters) clear?
(No parameters)
HTML5 how many scenarios are available for local storage: