HTML5 Web Storage
What is HTML Web Storage?(Wright-bestwebdesign)
With web storage, web applications can store data locally inside the customer's program.
Before HTML5, application data must be secured in treats, consolidated into every server request. Web storage is more secure, and a considerable measure of data can be secured locally, without affecting website execution.
Not in the slightest degree like treats, quite far will be far greater (no under 5MB) and information is never traded to the server.
Web storage is per beginning stage (per space and tradition). All pages, from one beginning stage, can store and access comparative data
Browser Support
The localStorage Object
Example
// StorelocalStorage.setItem("lastname", "Smith");
// Retrieve document.getElementById("result").innerHTML = localStorage.getItem("lastname");
// Retrieve document.getElementById("result").innerHTML = localStorage.getItem("lastname");
The sessionStorage Object
Example
if (sessionStorage.clickcount) {
sessionStorage.clickcount = Number(sessionStorage.clickcount) + 1;
} else {
sessionStorage.clickcount = 1;
}
document.getElementById("result").innerHTML = "You have clicked the button " +
sessionStorage.clickcount + " time(s) in this session.";
sessionStorage.clickcount = Number(sessionStorage.clickcount) + 1;
} else {
sessionStorage.clickcount = 1;
}
document.getElementById("result").innerHTML = "You have clicked the button " +
sessionStorage.clickcount + " time(s) in this session.";
Wright © bestwebdesign and Graphics design
0 comments:
Post a Comment