Skip to content Skip to sidebar Skip to footer

Javascript Cookie Doesn't Work On All Page

Live site- http://chitrchatr.com I successfully add setCookie function on exit button & another link. So, if anyone close popup or click on that link then cookie will be stored

Solution 1:

add path to your cookie

functionsetCookie(name, value, days, secure) {
  var expires = '';
  if (days) {
    var date = newDate();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    expires = '; expires='+date.toGMTString();
  }
  var domain = locDomain;
  document.cookie = name + '='+escape(value) + expires + '; path=/' + (domain ? '; domain=.' + domain : '') + ((secure && locProtocol == 'https:') ? '; secure' : '');
}

Solution 2:

Try setting the location of cookie as '/'

Post a Comment for "Javascript Cookie Doesn't Work On All Page"