Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Domain wide localStorage fall-back for I6 & IE7?

In our current project, we're using HTML 5 localStorage with fall-back to global storage for Firefox and userdata behaviors for IE6/IE7. The fall-back is provided through a JS script called jStorage.

This worked ok, until we started testing in IE6/IE7, even though it "works", it turns out that there's a restriction in userdata behaviour which locks it down so storage can only be set and read on the same URL or as MSDN puts it "For security reasons, a UserData store is available only in the same directory and with the same protocol used to persist the store".

Hence if I set a value on one page and then navigate to another, although I'm on the same site, it won't work. Which for us pretty much renders it unusable as a fall-back for local storage, which is scoped per domain.

Has anyone come across this problem before and found a decent solution?
Any ideas or thoughts will be appreciated.

like image 714
Ola Karlsson Avatar asked Feb 14 '12 08:02

Ola Karlsson


1 Answers

Remy Sharp's polyfill will do that.

https://gist.github.com/remy/350433

like image 117
Erik Avatar answered Nov 11 '22 03:11

Erik