0

I simply want to display a notification in javascript once someone open the page for the first time (1yr expiredate).

var CookieDate = new Date;
CookieDate.setFullYear(CookieDate.getFullYear( ) +1);
document.cookie = 'info=true; expires=' + CookieDate.toGMTString( ) + ';';

After that i try to read the cookie with

var x = document.cookie;
if x == "true" {..}else{...}

but i never get anything even if i try to go with

var x = document.cookie;
alert(x)

this ends up empty.

(Jquery is no option)

Fabian Boulegue
  • 6,476
  • 14
  • 47
  • 72

0 Answers0