Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

116
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda