Cookie does not survive when Browser is closed #74

Closed
besi opened this Issue Jun 18, 2012 · 3 comments

Projects

None yet

4 participants

@besi
besi commented Jun 18, 2012

I set a cookie if it does not exist and set the value to 0. However, as soon as I close the browser the cookie gets deleted.

var loginCount = parseInt($.cookie("loginCount"));

if(!loginCount){
  $.cookie("loginCount", 0, { expires: 7 });
  loginCount = 0;
  alert("Cookie created");
}

$("#numberOfLogins").text(loginCount);

// cookie is incremented upon login
@Krinkle
Contributor
Krinkle commented Jul 5, 2012

That likely means either your incremental script is broken or your browser doesn't support cookies. Please include the relevant code.

Example (works fine): http://jsbin.com/ejefit

@FagnerMartinsBrack
Collaborator

Probably you marked your browser to delete the cookies when closing it or you are using chrome on localhost (http://stackoverflow.com/questions/7346919/chrome-localhost-cookie-not-being-set)

@carhartl
Owner
carhartl commented Jul 7, 2012

Quickly tested in Safari and Firefox, no issues. Please provide a proper test case.

@carhartl carhartl closed this Jul 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment