Reputation: 8000
I have it so that users can copy and paste objects from one page to another. I use cookies to hold the object data.
On very rare occasions the amount of data (when escaped) has exceeded the 4k limit.
There are two ways around this I can see.
I think the first solution might just push the problem further under the carpet and will come back and bite me in months to come.
But is the second solution a good idea? Has anyone done it before or is there some other client side storage mechanism that would be better here?
NB: I have used sessvars.js elsewhere in the site and I have been looking at using jstorage
Upvotes: 3
Views: 318
Reputation: 29831
HTML5 localStorage is very useful. I do not know your requirements but it is compatible in IE8+, and most modern browsers.
Upvotes: 2
Reputation: 8000
I've decided to go ahead and use jstorage as mentioned in the question. It's a decent alternative to what I have and makes use of html 5 localstorage if the browser allows it.
Upvotes: 1
Reputation:
Have you already considered to use localstorage instead? You have 4/5 Mb of space depending of which browser you are using
http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-learning-about-html5-local-storage/
Anyway on older browser not supporting localstorage I would choose the first solution because cookies are passed with http headers so I'd prefer less cookies solution.
Upvotes: 2