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

167
Visualizações
Javascript script reading data from deleted cookie (Safari)

I use the following in PHP to delete a cookie:

setcookie("cart", "", time()-3600, "/", ".site.net");

Which works as expected, when I link through to the following page the cookie is not found by PHP and I can confirm it has been deleted using the web inspector in Safari.

However the cookie is still being read on the second page by Javascript as is it was never deleted. I read the cookie in Javascript with:

 var result = document.cookie.match(new RegExp(name + '=([^;]+)'));

Even if I keep reloading the page Javascript loads the cookie (and PHP does not). If I shift reload Javascript stops reading the cookie, so evidently the cookie is being cached and read.

I don't want to turn off caching for the whole page using HTML tags, so is there a way to stop caching of cookies alone, or to stop Javascript using the cache on this page?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If I delete the cookie via Javascript there is no issue.

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