Saving data on the device


I’m doing the html+js part of my first app, and just realized that I don’t know if I can save data on the device if using only html and javascript. Looks like I’ll have to contact the server, which is ok. But does that means that I have to write the password every time?

I’m doing a simple game just to learn the basics of app development. Since I already know some html and js plus RoR, ionic seems like the perfect fit for me. The game will be played by two people, communicating trough the server. Now, each player should have some kind of hash or password, otherwise I’ll have to make the server open to calls from anyone, and that’s not nice.

So my questions is, how do I save a hash or password of somekind? is there a way to save private data on the device? with js alone I don’t think so, but maybe with angular and ionic you can?


This is very easy using the local storage which allows you to store key pair values that would be available between sessions of app use.
Read the official Cordova/Phonegap localStorage API