Hacker News new | past | comments | ask | show | jobs | submit login
Local Storage And How To Use It On Websites (smashingmagazine.com)
48 points by fogus on Oct 11, 2010 | hide | past | favorite | 14 comments



Store.js - cross browser local storage without using cookies or flash (supports even IE6 OMG!)

http://news.ycombinator.com/item?id=1468802


Dive Into HTML5 has another good overview of using Local Storage, along with ways to fall back on other methods if it's not supported and some information about (potential) replacements: http://diveintohtml5.org/storage.html


> Because cookies have been used to spy on people’s surfing behavior, security-conscious people and companies turn them off or request to be asked every time whether a cookie should be set.

Won't local storage run into this very same problem rather quickly?


Good point.

For Firefox users, browse to "about:config", then search for "dom.storage.enabled".


My biggest beef with local storage is the seemingly arbitrary 5MB storage limit. I understand that you have to set a limit somewhere, but why so little?

I've already hit this limit when trying to do long-term caching of server-side data in one web app. It's 2010, why can't we have 100MB of storage per domain?


Well it's a step up from 4K :)

I'm not sure I'd especially like each site I visit to possibly use 100MB of my storage (storage may be cheap, but so am I!), but I wouldn't see the problem in having some kind of dialog asking permission to use xMB if it's over 5. I realise that adds another layer of complication and may "frighten your gran".


Seems like it should be a browser setting. 5mb sounds entirely reasonable as a default value.


It is on some browsers (FireFox I think) and not on others. This would be fine with me if that was outlined in the spec, but these gray areas always produce 3-4 different implementations.


I'd be cool with that too if all the browsers implemented it. Sadly they do not :(


I believe the browser does ask if you want to go over the limit. At least Safari's setting suggests that: http://imgur.com/wfMDA.png


That's database storage, not local storage. Currently, when you hit the 5MB limit it just throws a JavaScript error.


Sorry, you're correct. I assumed that Safari would display localStorage usage in the preferences as well but it does not.


Remy Sharp's Storage pollyfiller[1].

(What's a pollyfill? Good question[2]!)

-----

[1]: http://gist.github.com/350433

[2]: http://remysharp.com/2010/10/08/what-is-a-polyfill/


http://github.com/benpickles/js-model

A JS ORM that can use localStorage as ... storage.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: