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

130
Visualizações
Adding multiple local storage for same site

enter image description here

  • Under the 'Application' tab of chrome I've found there are multiple localstorage (please see the yellow box) like - https://stackoverflow.com , https://www.google.com etc.
  • I'm now in stackoverflow (#1)
  • I'm trying to add a new local storage by the name https://mytestdomain.com so I can see it in the yellow box
  • I've tried the following javascript code to achieve this
var testObject = { 'one': 1, 'two': 2, 'three': 3 };  
localStorage.setItem('https://mytestdomain.com', JSON.stringify(testObject));
  • but it always gets added under the localstorage - https://stackoverflow.com (#2, #3). It's not being added as a new localStorage

Can anyone help me here?

Thanks in advance.

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

0

That yellow box in the image represents all the sites which are storing some data in your localstorage. You cannot add a sitename (i.e https://mytestdomain.com) using localstorage.setItem().

Using localstorage.setItem('key', 'val') only set value in current domain's local Storage

If you want some value under https://mytestdomain.com domain, there should be a site with url - https://mytestdomain.com storing something in your localstorage.

Check here in the official doc for more info - Documentation Link

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