Josef Richter
Josef Richter

Reputation: 507

how to access a subdomain's html5 localStorage from the root domain?

When I have www.mydomain.com and mydomain.com, each of them gets a separate localStorage.

I've read here http://msdn.microsoft.com/en-us/library/cc197062(VS.85).aspx that I can access www.mydomain.com's localStorage from mydomain.com root domain. But how do I do that? I've tried localstorage['www.mydomain.com'].getItem... but that doesn't seem to work.

Is that IE specific? I tried in Safari 5.

Thank you.

Upvotes: 1

Views: 5354

Answers (1)

Ofir D
Ofir D

Reputation: 818

I've wrote a cool library that solves the cross domain local storage problem using shared iframe and post messages. It event comes with angularjs support. Check it out on github

Upvotes: 1

Related Questions