Sometimes we need to store data accessed from the Internet to your local system. The most common method to store data locally in all browsers is cookies which are key-value pairs of strings that are stored locally in a text file. These text files are sent to the server having the some domain name with respect to every hyper text transfer protocol (HTTP) respect. HTML5 provides a new feature that supports the client - side Storage which is further divided into the following types of storage.
sessionStorage.setItem('fullname', a kumar ') ;
alert("Your name is:"+sessionStorage.getItem('fullname'));
alert ("Hello "+sessionStorage.fullname);
sessionStorage.removeItem('fullname');
2.Local storage:- Local storage is same as the session storage except the feature of persistency. In other words a localStorage object can be assured as a persistent version of a sessionStorage object.
For example:-
sessionStorage.setItem('fullname', a kumar ') ;
- Session storage :- session storage is a storage that acts as cookies but has more storage capacity. A cookies has the capacity to store a maximum of 4 kilobytes (KB) data. However a session storage has the capacity to store data in mega bytes (MB).
sessionStorage.setItem('fullname', a kumar ') ;
alert("Your name is:"+sessionStorage.getItem('fullname'));
alert ("Hello "+sessionStorage.fullname);
sessionStorage.removeItem('fullname');
2.Local storage:- Local storage is same as the session storage except the feature of persistency. In other words a localStorage object can be assured as a persistent version of a sessionStorage object.
For example:-
sessionStorage.setItem('fullname', a kumar ') ;
alert("Your name is:"+sessionStorage.getItem('fullname'));
alert ("Hello "+sessionStorage.fullname);
sessionStorage.removeItem('fullname');
3.Database storage :- HTML5 also provides database storage to store data on a clients machine using a Structured Query language (SQL) database. It uses a temporary database to store data for a specified period of time.
db=openDatabase("DBTest", 1.0,"HTML5 Database API example ", 200000);
No comments:
Post a Comment