Answer the question
In order to leave comments, you need to log in
Using shared localStorage for subdomains?
Hello. I'm looking for advice. The task is not to drive data through cookies constantly to the server, but to store them in localStorage and have access to them via JavaScript.
The problem is that localStorage only gives access to a specific address. That is, for addresses:
sub.domain.ru
sub2.domain.ru the
data will be different. Is there any way to combine the data?
Tried the option with iframe:
var ifr = document.createElement('iframe');<br/>
ifr.src = 'domain.ru/localstorage.html';<br/>
ifr.name = 'localStorageIframe';<br/>
document.body.appendChild( ifr );<br/>
Answer the question
In order to leave comments, you need to log in
And if there is a js code on the domain.ru/localstorage.html page, will it have access to the localstorage of the main domain? Then you can pull out the data using this code, and send tasks to it somehow through events, properties of the window object (in the child frame - parent) or DOM objects. (Unfortunately, I don't have an easy way to test this hypothesis right now.)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question