Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

209
Visualizações
Fetch another site's localstorage data

I have two different site's data stored in localstorage, let's say xyz.com and abc.com. The thing is i can only access the data in which site I'm currently on. How can I access localstorage of abc.com if I'm on xyz.com?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

As others have already pointed out in the comments this is not possible.

If you read the documentation for Web Storage API (which consists of both localStorage and sessionStorage) you will see this.

A different Storage object is used for the sessionStorage and localStorage for each origin — they function and are controlled separately.

An origin in this context is defined as this.

Web content's origin is defined by the scheme (protocol), hostname (domain), and port of the URL used to access it. Two objects have the same origin only when the scheme, hostname, and port all match.

https://developer.mozilla.org/en-US/docs/Glossary/Origin

Since you in your example have two different hostnames, they are separate origins and therefore can't access each others localStorage.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda