Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

131
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda