html 5 storage websql, and localStorage : for how long data is stored?
Asked Answered
E

2

11

With new Html 5 there are 3 main ways to store data in your browser:

  • localStorage
  • WebSQL DB
  • Indexed DB

I wanted to know, for each of the types, for how long data is stored? If the user enters the day after, the data will still be there? after one month? and one year?

Thanks

Edy answered 19/12, 2011 at 16:13 Comment(2)
All three are persistent unless user wipes them. For differences have a look here.Omor
For all 3, there is no programmatic way to expire...It is entirely upto the user.. There is a really good tutorial on HTML5 Local Storage at itunes.apple.com/in/app/designmobileweb/id486198804?mt=8Copybook
D
7

The most correct answer to this question is: You don't know.

The user could wipe his/her local data at any time, and any type of local storage is subject to user preferences and to be considered extremely volatile. However, there is no defined expiration time, according to Web Storage specifications:

Expiring stored data

User agents may, if so configured by the user, automatically delete stored data after a period of time.

For example, a user agent could be configured to treat third-party local storage areas as session-only storage, deleting the data once the user had closed all the browsing contexts that could access it.

This can restrict the ability of a site to track a user, as the site would then only be able to track the user across multiple sessions when he authenticates with the site itself (e.g. by making a purchase or logging in to a service).

However, this also reduces the usefulness of the API as a long-term storage mechanism. It can also put the user's data at risk, if the user does not fully understand the implications of data expiration.

Source: http://dev.w3.org/html5/webstorage/

Derwood answered 19/12, 2011 at 16:17 Comment(0)
W
4
  • WebSQL is deprecated. See here.
  • Indexed DB is persistent.
  • localStorage is also persistent (not to be confused with sessionStorage).

'Persistent' comes with the caveat that atornblad pointed out: it's only persistent until the user decides to wipe their own data.

Worriment answered 19/12, 2011 at 16:31 Comment(2)
WebSQL is deprecated, but at the current moment there is nothing that replaces it. So...Edy
Indeed, it's only deprecated because people quickly united behind a single solution (sqLite), which made proceeding with a formal standard seem redundant. PhoneGap and many other significant platforms thus continue to rely on WebSQL, and it doesn't seem to be going anywhere.Cringle

© 2022 - 2024 — McMap. All rights reserved.