• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

Expire cookie in 5 minutes

Hi All

I need this coookie to expire in 5 minutes.


CURRNENT CODE:

<script language="JavaScript">
<!--

function SetCookie(){
document.cookie = "UserHasCookie=Yes; path=/";
}

//-->
</script>
0
blnukem
Asked:
blnukem
1 Solution
 
TimYatesCommented:
   var now = new Date() ;
    now.setMinutes( now.getMinutes() + 5 ) ;
    document.cookie = "UserHasCookie=Yes; expires=" + now.toGMTString() + "; path=/";

should work...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now