4

I am looking at making a javascript app which is primarily reliant upon browser localstorage or websql (not sure which to target yet), however I was wondering if I were to save the users application data within there, will it be cleared if they clear cache or cookies?

My main deployment platform at the moment would be smart phones using phonegap.

4
  • Haven't got an app which uses a localstorage/websql, and I dont own all devices or have all browsers installed... if I knew the answer I wouldn't ask the question would I... Commented Jan 27, 2012 at 9:55
  • If you want to know the answer, you'll need to get hold of all the devices and browsers and check. There's nothing in the standard which defines user agent behaviour for this. Commented Jan 27, 2012 at 11:26
  • Again, rather than spending lots of money on devices and time writing and testing this, I was hoping someone may be able to give at least a semi informed answer to this? I looked but found no one complaining of issues with their local storages being wiped, which makes me think they do not get cleared unless the user specifically finds some browser specific option to remove it, but with phones having limited internal storage/memory I wasn't sure if they would adhere to this assumption, if the assumption was even correct to begin with. Commented Jan 27, 2012 at 11:58
  • No-one can be sure, it's something that could be different on any browser and phone. Commented Jan 27, 2012 at 14:11

4 Answers 4

6

Clearing cookies will clear the storage. Clearing cache will not affect your storage.

Sign up to request clarification or add additional context in comments.

Comments

4

Your localStorage will stick around no matter what, it belongs to the app.

It will only go away if the user deletes the app. I'm not totally sure if this is the same for web apps as those do rely on the mobile browser in which case the localStorage belongs to that app.

5 Comments

To my knowledge PhoneGap uses the web database rather than the native OS database, but I cannot confirm...
it all depends on the type of data you want to store, phonegap also has lawnchair which is a storage method, but for usernames, passwords, and app settings you can store them all in localstorage and they will stick around. I use it to keep my tokens for twitter and facebook, as well as global app settings.
As this would be more of a native app I was thinking more for storing user options, and anything saved by the app. If this were a game I would be wanting to put save games in there and some game state content etc.
Clearing the cookies also clears the localstorage on most browser, see comments in this post sharonminsuk.com/blog/2011/03/21/…
@JulienKronegg Localstorage for phonegap / cordova differs from safari memory and storage... The app is sandboxed - the data is sandboxed... A webapp it will but not an app.
0

Your Local Storage will remain intact irrespective of you clearing the cache or cookies, this is what I found while testing my browser extension app.

Comments

-1

Clearing the cookie clears storage.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.