Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!