What is the most persistent HTML5 data storage?

277 views Asked by At

Pre-HTML5 we had cookies, but they aren't a reliable way to persistently store data for a user locally because a user can (and does) clear their cookies in their browser.

Now, HTML5 introduces localStorage as an alternative (which has the benefit of not being sent with every HTTP request). However, it suffers the same fate as cookies do–death by deletion.

Local data persistency is inherently unreliable in the sense that a user has the ultimate control. But, cookies and localStorage can very easily be removed without a user knowing exactly what it is they're doing when removing their browser's data.

What HTML5 feature is the most reliable means of storing persistent data locally without the risk of a user removing it inadvertently?

1

There are 1 answers

0
Evan Tobin On

All data stored on a clients computer has the ability of being cleared when they clear their browsing data. Indexeddb, WebSQL and all other methods of storing data on a client's computer related to the browser suffer from this flaw.

One option is to store the data on your server and then simply give the user a key that can be used to retrieve that data.

Another option is to use Java or another plugin that can access the actual file system to write to the clients computer.

No matter what, all data that is given to the client has the ability to be messed with and should be treated the same as user input.