Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a modern sessionStorage alternative that works across subdomains?

We recently switched from cookies to using sessionStorage - the trigger for switching was IE issues.

Now, we're discovering that sessionStorage doesn't work across sub-domains - the storage of www.site.com is isolated from that of site.com.

Is there a modern alternative to get the two to cooperate? This is easily accomplished by cookies, but I'd hate to revert from sessionStorage, or (gasp) use both methods concurrently.

like image 689
ripper234 Avatar asked Jun 20 '12 14:06

ripper234


1 Answers

This is almost a hack, and its not secure but it's a neat trick never the less. JavaScript object window.name can hold strings of data and the data does persist even when loading a new page or switching domains. Check this SO about it here:

Using window.name as a local data cache in web browsers

like image 138
Phillip Berger Avatar answered Oct 22 '22 01:10

Phillip Berger