Matt Winward
Matt Winward

Reputation: 1255

Neither cookies nor HTML5 local storage working in anything except Chrome

I'm working on a javascript-driven tool that will store a user's selections locally and then repopulate when the page is next navigated to. It's working fine in Chrome but not at all in IE8 or Safari.

I've tried to store this information in cookies using standard javascript, and using the jquery.cookie.js plugin, and also more recently I've tried using local storage instead. I'm storing a lump of XML, so my theory was that perhaps it's too large to store in a cookie, but there's no way it's too large for local storage.

I'm testing this on my local IIS under localhost. Can anyone think of any reason why the other browsers aren't working? I'm finding it strange that it affects both cookies and local storage. I can only think it's some kind of a security setting that's restricting any kind of local storage, cookie or otherwise.

I've played around with settings in IE, settings in IIS, but can't work it out. Any thoughts or ideas would be most welcome!

Regards,

Matt

Upvotes: 0

Views: 1036

Answers (2)

DaveS
DaveS

Reputation: 3294

Is the XML in a string, or is it in an object like a DOM reference? I believe IE8's localStorage can only take strings as keys AND values...or primative values that can be automatically cast to string...so you'll have to stringify the object.

If you're worried about size constraints in IE8, check the value of localStorage.remainingSpace (IE-specific property).

I'm not sure why Safari isn't working for you if it works in Chrome. Maybe it can only take strings too.

Upvotes: 1

hvgotcodes
hvgotcodes

Reputation: 120198

how are you saving the data? If it works in Chrome, Im surprised that it is not working in Safari. use the developer tools to see what is in your localstorage. Use firebug in firefox.

In other words, figure out where it is failing first.

Upvotes: 0

Related Questions