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

94
Views
Html and javascript cookie dying after browser window closes

I've added a darkmode setting to my website, and I made a cookie using javascript so it's saved for when you come back, everything works like a charm until you close the browser window.

var cookie = document.cookie = 'darkmode=false; SameSite=none; Secure';

Is there a way to make the cookie stay for as long as possible?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You should add expires and/or max-age for the cookie. Check the documentation for more information.

var cookie = document.cookie = 'darkmode=false; max-age=31536000; expires=Fri, 31 Dec 9999 23:59:59 GMT; SameSite=none; Secure';
about 4 years ago · Juan Pablo Isaza Report
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!