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

202
Vistas
Set cookie to redirect user if set cookie exists

I have some experience with JavaScript, but I'm racking my brain with cookies. I'm trying to set a cookie for users who access page X, and then redirect them to that same page X if they visit page Y.

See a more detailed example:

When a user visits https://www.example.com/page.html, I need a cookie to be set.

When this same user visits https://www.example.com/redirect.html, I need to check if the cookie that was set on https://www.example.com/page.html exists, if it exists then this user must be redirect to https://www.example.com/page.html.

Basically it's setting a cookie, if that cookie exists then something happens. I know how to do the redirect with JavaScript, but how do I set and read this cookie?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can create routes and set and receive cookies in the request and response object.

Set a cookie like this: res.cookie(cookie_name,cookie value);

Read a cookie like this: req.cookie['cookie_name'];

More about using cookies here

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