Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 991
Mateu Avatar asked Dec 19 '11 16:12

Mateu


People also ask

How long does Local Storage last?

LocalStorage has no expiration time, Data in the LocalStorage persist till the user manually delete it. This is the only difference between LocalStorage and SessionStorage.

How does the data is stored in HTML5 web storage?

HTML web storage provides two objects for storing data on the client: window.localStorage - stores data with no expiration date. window.sessionStorage - stores data for one session (data is lost when the browser tab is closed)

How much data can we store in Local Storage?

It is limited to about 5MB and can contain only strings. LocalStorage is not accessible from web workers or service workers. Cookies have their uses, but should not be used for storage.

How many types of storage are there in HTML5?

In HTML5 there are two types of web storage API. localStorage: It is used to store data on the client-side.


1 Answers

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/

like image 108
Anders Marzi Tornblad Avatar answered Sep 29 '22 21:09

Anders Marzi Tornblad