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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cookie Dissapear!

Status
Not open for further replies.

iLy54

Programmer
Sep 5, 2002
33
0
0
ZA
hi peolpe.
im having difficulty with my exp date of a cookie that i'v set. This is the function i use:

function getCookieExpireDate(noDays){
var today = new Date()
var expr = new Date(today.getTime()+1000*60*60*24*365)
return expr.toGMTString()
}

i'v set it to expire after a year but the cookie expires as soon as i close the browser.once i reload the page that is supposed 2 read the cookie, the information area is blank as if there is no cookie.

this is how i read the cookie on the desired page:

var results = &quot;<B>Your Name:</B> &quot; + readCookie(&quot;cName&quot;)
document.write(results)


the cookie works perfectly as long as the browser is open but as soon as i close it and then return to the page where cookie is read the &quot;Your Name&quot; field is blank.

can any1 offer me any suggestions?
mayb all my code needs 2b posted and if it does then i wil be willing to do so.
thank you all
-Mon3y is the r00t of all evil and every man needs roots-
 
sometimes it can be some security issues...or try to play with the path attribute of your cookies...might help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top