Tuesday, March 26, 2013; 8:57:18 AM Eastern
HTML 5 local storage FAQ
- After a few thousand people looked at Little Outliner yesterday, it's clear that some users are uncomfortable with the idea of local storage. For many, apparently this is the first time they have encoutered this HTML 5 feature.
- I looked for a user-oriented FAQ on local storage but all I found were descriptions of the feature for developers. And for developers, there really isn't that much to know. I've put the details under this headline, you can expand it if you care.
- There's a new browser object called localStorage. It behaves like any other JavaScript object except it persists. That means the next time the user comes back to your site, the storage will still be there, exactly as it was last time they visited.
- In most browsers the object is attached to a single domain, so joe.userland.com and mary.userland.com will have different localStorage objects. Apparently Firefox is different, in that joe and mary share a localStorage object. There are reasons to do it either way. It would be nice if they all did it the same way. ;-)
- So here are some answers to frequently asked question.
- 1. Where is local storage stored? It varies from browser to browser. Some users have explored in the system settings folders on various operating systems and found the files. They look like they're SQL databases.
- 2. How much space does it use? The per-domain limit is 5MB.
- 3. When you clear the cache does local storage get cleared too? I don't know.
- 4. Isn't local storage like cookies? Yes, it's very much like cookies, except cookies are limited to 4K, and local storage can go up to 5MB. The difference in size reflects the difference in times. When cookies were invented, in the mid-90s, computers had a lot less memory. Today it's not uncommon for a new computer to have a terabyte of disk space. 5MB today is like what 4K was back then. It seems silly to live in a world limited by the machines of the past. But cookies couldn't change without risking breakage, of the web itself. So local storage was a good answer. Also local storage is simpler to program than cookies, but not so much simpler as to make a huge difference.
- 5. Isn't this a potentially dangerous feature? We are very responsible about our software, we just want people to make outlines and be happy and want to use the new stuff we come out with. This is a business for us. So we would never use it in a harmful way. Not only would it be against our interest, but it would be professionally unthinkable. That said, localStorage is a potentially dangerous feature, in the hands of a malicious website. This is something the browser vendors will probably have to address sooner or later. Probably sooner. ;-)
- 6. How can I get rid of what you stored on my computer? I can only answer for our product. If you delete all the text in your outline, that will get rid of most of what we store. There will still be an empty outline in local storage, and a count of the number of times you saved. That takes up about 140 characters, or coincidentally, the size of a tweet. If even this is too much to bear, we can add a way for you to delete that too. (I imagine someone will say that it is, so I'm already preparing to write the code.)
- If you have other questions, ask them below and we'll try to answer them, the best we can.