ravi saurav
ravi saurav

Reputation: 59

Save data entered in the fields of an html page when connection to server is lost

If we have an online form to be filled(an application form), an html page and the fields are filled with data and save button is clicked at that very moment the connection to server is lost. How can we preserve the data which was fed in the fields of the html page?

Upvotes: 0

Views: 97

Answers (1)

bhspencer
bhspencer

Reputation: 13570

You can store data in localStorage.

localStorage.setItem("someItemName", "Value");

On page load you could check to see if there is any data in localStorage with:

var yourdata = localStorage.getItem("someItemName");

Upvotes: 1

Related Questions