Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

168
Vistas
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 Respuestas
Responde la pregunta

0

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

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda