• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Pruebas Online
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

175
Vistas
Unclear how to read cookie properties and use in conditionals -

I'm using js-cookie:

It's easy to set a cookie, but I'm unclear how to output specific values and test against them. This works fine:

Cookies.set('newsletter', 'show', { expires: 30, path: '/' });
var myCookie = Cookies.get('newsletter');

But this does not:

if(myCookie){
  var p = Cookies.get(['expires']);
  document.write(p);
}

How do I access the expires property?

almost 3 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

According to this issue it is not possible

It‘s not possible.

Also in the FAQ it states the same thing:

It's not possible. Once the cookie has been written, its attributes can‘t be read out. The underlying API we‘re constraint to use doesn‘t support this: https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie

almost 3 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 Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda