Skip to content Skip to sidebar Skip to footer

Are Cookies Fit For Just Client Side Usage?

I want to store some non confidential data on the user's browser (or any device/mobile browser) for the next session. I can store that on the cookies but I dont want to send that c

Solution 1:

localStorage is supported pretty well.
AmplifyJS provides non-cookie fallbacks for other browsers, with cookies being the last resort.


Solution 2:

Cookies will be sent on every request to the server (assuming the host & path match).

If you just want a certain page, you can restrict the cookies to a path - take a look at this question.

But I'd go with local storage first.


Solution 3:

LocalStorage is the way to go. Just have a look at this great presentation.


Solution 4:

Cookies are pre-ajax and were originally implemented to always be sent along in server requests. I would go with local storage with cookies as a fallback for older browsers if you're actually supporting them. People still using IE7 and below aren't exactly performance hounds anyway. If the issue is more about costs on your back end, I would suggest polling to get an idea of how many users will likely actually be relying on the cookie fallbacks. The costs may not actually be significant. IE6 usage is pretty much irrelevant and IE7 is marginalized to the point where people are dropping support for that too. But mostly I would fight like a rabid dog to avoid graceful degradation support for browsers that are over five years old. It solves a lot of problems outright and opens a lot of new doors.


Post a Comment for "Are Cookies Fit For Just Client Side Usage?"