Page 1 of 1

Using LocalStorage vs db for user settings

Posted: Tue Sep 17, 2013 2:02 pm
by osiris1@yahoo.com

I developing an app and not sure if I want to use the database function to store data on the cloud. I want my data to be stored locally on the device (IOS) and don't need the overhead of going back to the server to get it.

So I'm using the "localStorage" method.

Is this advisable? Should I be using something else? I need to the data to be persistent since I'm saving user settings that the app depends on.

Any advise would be appreciated.


Using LocalStorage vs db for user settings

Posted: Tue Sep 17, 2013 2:28 pm
by maxkatz

Saving user settings in local storage as fine as long as you don't store any sensitive data. Also keep in mind that the data can be deleted by the user -- so you need to add the logic to reset the settings.


Using LocalStorage vs db for user settings

Posted: Tue Sep 17, 2013 2:44 pm
by osiris1@yahoo.com

ok. Thanks for the info. No sensative data will be saved. But is the LocalStorage method reliable? When the app closes, it will be available again when the app runs and the user does not clear it?

Is there a local db option and is that recommended?


Using LocalStorage vs db for user settings

Posted: Tue Sep 17, 2013 2:45 pm
by maxkatz

Yes, the data will stay if you close the browser.

Local storage is a standard browser API, you can more about it here: https://developer.mozilla.org/en-US/d...

You can use in browser database as well.. but the API is a little bit more complicated.


Using LocalStorage vs db for user settings

Posted: Tue Sep 17, 2013 2:56 pm
by osiris1@yahoo.com

browser database meaning websql?


Using LocalStorage vs db for user settings

Posted: Tue Sep 17, 2013 2:58 pm
by maxkatz

Yes, or IndexedDB