Click to See Complete Forum and Search --> : Cookies


chuxs
11-27-2003, 11:10 AM
hw do i delete cookies when the user close the browser window

pyro
11-27-2003, 11:18 AM
When you set the cookie, do not set an expiry time, and it will expire when the browser is closed.

chuxs
11-27-2003, 11:41 AM
thanx, but is it possible for me to delete the cookie base on a specific time say 10 mins

pyro
11-27-2003, 11:52 AM
10 minutes from when it was set, or 10 minutes after the browser was closed?

chuxs
11-28-2003, 03:52 AM
10 minutes from when it was set

pyro
11-28-2003, 11:21 AM
Try this:

<script type="text/javascript">
expiry = new Date();
expiry.setTime(expiry.getTime()+600000);
document.cookie = "cookiename=value; expires="+expiry.toGMTString();
</script>

chuxs
12-01-2003, 08:57 AM
thanx

pyro
12-01-2003, 10:43 AM
You're welcome.