Keeping text in input fields


#1

Hey everyone!
Sometimes after I’ve typed some long, long text into an input field I accidentally navigate away from the page. And when I press ‘back’, good sites keep my old text in the input field (bad sites don’t). I want to build a good site with Meteor, so how do I embed that functionality?
Note: I would like not to use Users collection for storing input.


#2

You could use a separate collection or one of the many packages that let you use the browser’s local storage.

Regardless of where you store it, it’s simply a matter of periodically pushing whatever is in the input field into that storage method and then checking whenever the user returns if you should pull that information back into the field or not.


#3

As said by nkrisc you could put the session state in browser’s localstorage.
Or you could store this state on the server with a collection, that way the state would be preserved even with another browser on another computer…