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

133
Vistas
Cookie in Javascript don't reset after it's expired

I'm having this issue.

I'm working on a courses webpage where I have loading animation that is now only shown first time when a user visits the site. I'm changing it now so the cookie that holds the animation is reset after 1 hour.

The issues is that the cookie doesn't reset. Time to Live was set and it works but the cookie doesn't clear itself after an hour. Here is the code that is used to set the cookie timeToLive and value

if(localStorage.getItem("loader-cookie")) {
        document.getElementById("application-loader").classList.remove("is-active");
    } else {
        document.getElementById("application-loader").classList.add("is-active");

        // If loader-cookie expired we add a new one
        const storageItem = {
            value: "loader-cookie",
            timeToLive: Date.now() / 1000 + 3600,
        };

        localStorage.setItem("loader-cookie", JSON.stringify(storageItem));
    }

Let me know if more info is needed for the problem.

Thank you

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