Searched everywhere and didn't find straight answer.
Does CORS make cross-(sub)domain localStorage sharing possible or not?
And how about on IE8?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
No, you cannot directly access another origin's storage, regardless of CORS settings.
You could however have a remote AJAX service that could store your settings on the remote domain.
e.g. Say your main website www.maindomain.com
returns header Access-Control-Allow-Origin: https://www.subsite.com
for its AJAX requests.
Then your other website www.subsite.com
can make an AJAX request to e.g. https://www.maindomain.com/storage
to retrieve or to save details cross-origin. The local storage for www.maindomain.com
can be returned as a JSON object in the response for www.subsite.com
to use.