PDA

View Full Version : Cookies Expiration Date


quantumpixel
12-09-2002, 05:48 AM
how can i make a cookie expire after 20 mins ?

i want it for a session only cookie, and after two minutes it should force the user to sign in again...

hope someone can help me

eloi_egon
12-09-2002, 09:38 PM
Sorry, haven't much expirience with cookies, but i found this

Crispy JavaScript Cookies (http://www.webreference.com/js/column8/)

Don't know if it helps you much but i found something that had to do with setting time. Take a look at the section "How to "remember" the user's name. "

Philip M
12-16-2002, 07:37 PM
Here you are.


function setCookieValue() {
var expiry = new Date();
expiry.setTime(expiry.getTime() + (60*20*1000)); //20 minutes after last page load
document.cookie = name + "=" + value + ";expires=" + expiry.toGMTString() +";";
}

This is JavaScript of course, not Perl.
Is that what you wanted? Or are we in the wrong forum?