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

110
Visualizações
How to clear the cookie when browsers tab is closed or entire browser is closed in React

I want to store the access tokens in cookies so that they are shareable across tabs, but my requirement is I want to clear the tokens when all the browser tabs are closed or the entire browser is closed. So I am really not sure what to provide in the expires column so that it can clear them on closing the browser tab.

I am not using localStorage because it is tough to clear tokens when the browser is closed, and the event listeners are not up to the mark.

And the same case for Session storage, it works like a charm, but it is hard to pass the token across tabs, and still using some workarounds, it is not up to the mark

So can anyone please help me on how to work on this requirement using cookies in react?

Thanks in advance!!!

about 4 years ago · Juan Pablo Isaza
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