Reputation:
I am trying to store 1000KB (~1MB) of data in a cookie in JavasSript but it is not working.
How can I do this?
Upvotes: 0
Views: 395
Reputation: 1115
Instead of a cookie use localStorage.
https://developer.mozilla.org/en/DOM/Storage
http://en.wikipedia.org/wiki/Web_Storage
Most browsers allow 5mb per domain, but IE will give you 10mb per domain.
Upvotes: 0
Reputation: 1
Don't do that. Sending a megabyte of data takes a lot of time (often more than a second). Keep some session status hidden inside your server. Then your cookie string is just a small opaque identifier which should be keyed by the server.
Upvotes: 2
Reputation: 24378
For IE, and I'm sure most other browsers, the limit is around 4K
For one domain name, each cookie is limited to 4,096 bytes
http://support.microsoft.com/kb/306070
Upvotes: 0