setMaxAge public void setMaxAge(int expiry)Sets the maximum age of the cookie in seconds. A positive value indicates that the cookie will expire after that many seconds have passed. Note that the value is the maximum age when the cookie will expire, not the cookie's current age.
A negative value means that the cookie is not stored persistently and will be deleted when the Web browser exits. A zero value causes the cookie to be deleted.
Parameters: expiry - an integer specifying the maximum age of the cookie in seconds; if negative, means the cookie is not stored; if zero, deletes the cookie See Also: getMaxAge() --------------------------------
Does this mean that I can delete a non-persistent cookie using something like:
? Or do I have to do something else to delete a cookie that is not stored persistently? My goal, btw, is to delete a cookie that is not stored persistently without closing the browser.
Did you say
to delete a cookie that is stored persistently without closing the browser ?[/QUOTE because there is a mismatch somewhere when you say to delete a cookie that is not stored persistently. There is nothing left for you to delete if it is not stored persistently , right ?
a cookie is persisted.
In a non-persistent case, you would not have anything to delete right ?
When you say
to make a cookie non-persistent. Nothing is set on the client and you have nothing to delete either.
You are right if this is what you meant : to remove "persistent" cookies you may do
You are also right, in that if you set it lasts only for a browser session. But even in this case the cookie is still persisted.
LXI Technologies P Ltd
Joined: Aug 08, 2001
This is a bit confusing, but let's say I create a cookie like this:
Now, suppose a little later on, I want to get rid of the above cookie without exiting the browser. Can I do this?
Thanks, Grant [ October 19, 2004: Message edited by: Grant Morris ]