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

129
Views
Use cookies that are not sent to server?

I'm building a site that has a few user options like dark or light mode (overriding the system default), default to X layout instead of Y, etc. None of these options need to be sent to the server. Is there a way that my JS can set cookies that aren't set to server? I was thinking maybe local storage is the solution but I know people get annoyed when they clear cookies and settings stick around (because local storage != cookie)

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

0

Is there a way that my JS can set cookies that aren't set to server?

Not as far as I'm aware. Any cookies that are visible to the site (which is what you'd want if you need to read them in JS) will be sent with any requests to the server. Unless you specifically add logic server-side which looks at those cookie values though, it likely won't actually do anything even if you do send them to the server.

You could use sessionStorage instead of localStorage if you don't mind it being cleared out when users close the tab (see https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage).

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!