Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 181
  • Last Modified:

Set Cookie Expiration

When is the cookie set to expire below and how to I adjust it to expire in 30 days or so?

<script language="JavaScript">

if (document.cookie.indexOf("ScriptBreaker.com") == -1) {

var expdate = new Date((new Date()).getTime() + 1000*60*10);

document.cookie="ScriptBreaker.com=general; expires=" +

expdate.toGMTString() + "; path=/;";

window.open("test.htm","","toolbars=no,align top left,width=340,height=425");

}

</script>
0
goldhart
Asked:
goldhart
  • 3
  • 2
1 Solution
 
Tomas Helgi JohannssonCommented:
   Hi!

To adjust the cookie to expire after 30 days just replace
1000*60*10 with 1000*60*60*24*30

Regards,
  Tomas Helgi

0
 
goldhartIT SpecialistAuthor Commented:
Thank you. But what is the 1000*60*10?
0
 
Tomas Helgi JohannssonCommented:
1000 is millisekonds
60 is seconds
10 is minutes

So this cookie has a 10 minute lifetime. :)

Regards,
   Tomas Helgi
0
 
goldhartIT SpecialistAuthor Commented:
Thank you! So 1000*60*60*24*1 would be one day?
0
 
Tomas Helgi JohannssonCommented:
Yes.

Regards,
   Tomas Helgi
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!

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