Tuesday, 15 May 2012

javascript - How to expire a cookie in 30 minutes using jQuery? -


How to eliminate a cookie in 30 minutes? I am using a jQuery cookie, I am able to do something like that.

  $ Cookie ("example", "foo", {expiration: 1});  

This is for 1 day. But how can we set the end time for 30 minutes

30 min 30 * 60 * Add the current date to specify the expiration date 30 minutes to 1000 milliseconds in the future.

  var date = new date (); Var minutes = 30; Date.SsetTime (date.getTime () + (min * 60 * 1000)); $ .cookie ("example", "foo", {expiration: date});  

No comments:

Post a Comment