Link to home
Start Free TrialLog in
Avatar of dragosh
dragosh

asked on

Set "Expires" attribute for a cookie

i need to set a cookie that will last "forever" .. how do i do that ??
(in JScript)

10x
ASKER CERTIFIED SOLUTION
Avatar of AlfaNoMore
AlfaNoMore

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ManuelMSP
ManuelMSP

Here you are:

if (getCookie(NameOfCookie)) {
  document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}

By the time it's 1970 again... If there not manually deleted !
Avatar of dragosh

ASKER

AlfaNoMore:

i think adding 1 year it's enough :))

10x