PDA

View Full Version : LocalStorage or simple JS var ?



siebmanb
21 Dec 2011, 8:34 AM
Hello everyone,

Simple question today : if I want to store a login and a password, why should I use LocalStorage when I can use two simple JS vars ?
Maybe I did not quite understand the way things work however ;)

Thank you all !
Have a nice end of year

mitchellsimoens
21 Dec 2011, 8:57 AM
I wouldn't store password, things are not encrypted in either LocalStorage and definitely not JavaScript. If you want to persist login, LocalStorage is a great candidate.

siebmanb
21 Dec 2011, 9:12 AM
Ok about encryption.
About persistance, if the app is shutdown and relaunched, wouldn't the LocalStorage emptied ?

mitchellsimoens
21 Dec 2011, 9:22 AM
Not unless you empty it