forms - Is HTML5 localstorage appropriate to store input field values? -
I have a question, how to store the local values of some form fields.
In my website, users use the keypad to keep the number of items counted. The objects they compute can enter a label for them. The problem is that each user applies different labels to their needs - and, whenever they go to the labels, they are empty.
My sites are running through site44.com, which is the server side php. So, in me, I think that using HTML5 local storage can allow the user to keep the label after leaving the site?
Is this the right interpretation?
Can someone give me a guide if I have 3 inputs - with different IDs - how to set the script?
You can use local storage like this:
On fn = document.getElementById. ("firstname") value; LocalStorage.setItem ("first name", fn); Var ln = document.getElementById ("lastname") value; LocalStorage.setItem ("Last Name", ln); Var em = document.getElementById ("email"). Values; LocalStorage.setItem ("Email", AM); Thus these items in the client browser will be set in your local storage. Now if a user comes later on the website then you can check for the value of localStorage and find the items you need.
When users arrive next time you agree to give a greeting message to him (he is not logged in at all), you can use a script like this:
var name = localStorage.getItem ("firstname"); Warning ("Hello" + name);
Comments
Post a Comment