1

I don't know how to test this locally.

Say I have a website at www.domain.com that stores something in localstorage. I have the web application at app.domain.com, can it access the item stored in localstorage by www.domain.com?

Is it accessible across subdomain?

  • 1
    No subdomain can not access to localstorage.You should use the cookies. https://stackoverflow.com/questions/18492576/share-cookies-between-subdomain-and-domain – Muhammet Can TONBUL Jan 13 '23 at 19:37
  • I see you are new here. If you want your questions to be well-received and answered, you should try to follow the posting guidelines in this resource https://stackoverflow.com/help/how-to-ask – bcstryker Jan 13 '23 at 19:41
  • See https://stackoverflow.com/questions/4026479/use-localstorage-across-subdomains – code Jan 13 '23 at 19:50

1 Answers1

0

Well, unfortunately no you can't.

Local Storage is used per exact domain.

However, you can use cookies instead:

You can specify the cookie domain in your header

Set-Cookie: name=value; domain=.mydomain.com

The leading '.' makes the cookie available for any subdomain.