Save and Restore form values using HTML5 localStorage.
Demo
Before HTML5, application data had to be stored in cookies, included in every server request. Local storage is more secure, and large amounts of data can be stored locally, without affecting website performance. Unlike cookies, the storage limit is far larger (at least 5MB) and information is never transferred to the server. Local storage is per domain. All pages, from one domain, can store and access the same data.
Additional reading
Mozilla Developer Network
You may install using package managers, or download project archive.
Installing via bower
will bring in the dependencies as well.
bower install webforms.save-restore
npm install webforms.save-restore
$(function() {
$("form")
.on("click", ".save", webforms.save) // save
.on("click", ".restore", webforms.restore) // restore
.on("submit", function(event) {
event.preventDefault();
webforms.clean.call(this); // clean
// do something else
});
});
bower install --save jQuery
- Chrome
- Firefox
- Safari
- IE 10+
This software is free to use under the MIT license.