Using HTML5 localStorage on a form
HTML5 localStorage provides us with the ability to store named key/value pairs locally within a users browser, this means that the data stored in localStorage is still there even after a user has closed the browser, deleted their cookies or turned off their machine/device.
The HTML5 localStorage attribute is supported by most modern browsers including Firefox 3.5+, Chrome 4+, Safari 4+, Mobile Safari, Android 2+ and Internet Explorer 8+.
Now lets dive into some code and create a basic working example. In this example we are going to create a simple form which stores the data entered into the form so that if the form isn’t submitted but the browser is closed the data is still store and then retrieved when the user returns to the form.