Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need a cookie to remain after the browser has been closed.

Status
Not open for further replies.

MrMilton

Programmer
Feb 25, 2004
6
CA
How do I create a cookie that will remain after the browser has been closed?

I need to set a cookie, and be able to access it in a number of days. Currently my cookies are lost when the browser is closed.

Thank you,


Mr Milton
 
set the cookie .expires = date() + 7 ' or however many days out you want it to last. BUT this will only work if the client so chooses to keep cookies that long.

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
The nature of using cookies and the lot of reasoning behind thier creation was to retain values after the session ends.

It (in my eyes and most older programmers) is bad form to use cookies unless they are to be used for that specific nature.

Although, cookies for some reason have been looked at in bad ways. No facts have been provided to say they are or can be used for virus or destructive means. The fact remains that people don't allow them though and any end user can set a browser to do just that. My blabbing has a end story [lol] -- I recommend using a DB to do things like this. That is the the best server side means to what you want. Cookies just aren't that stable of a means to shaddow who an end user is when they come back. or slap me for saying it -- you can use flat files

___________________________________________________________________

onpnt.com
SELECT * FROM programmers WHERE clue > 0
(0 row(s) affected) -->faq333-3811

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top