| | |
Cookies - I delete them and they creep back up
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2009
Posts: 7
Reputation:
Solved Threads: 0
Hi...
Can some one point out as to why my code does not work?
I've created some cookies like this:
and when I run the "delete cookies" they don't go away, only after I close the browser. I realize I set a 10 day life span,but if you delete them shouldn't they go away? Here is how I delete them.
Can some one point out as to why my code does not work?
I've created some cookies like this:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
var gotCookies = get_cookie(cookie_name); var exdate = new Date(); exdate.setDate(exdate.getDate()+10); if(gotCookies != null) { //var gotCookie = document.cookie.split("; "); //var old_selection = gotCookie[0].split(", "); var new_selection = cbId; document.cookie = cookie_name+"="+gotCookies + ',<' + escape(new_selection) + ">,expires="+exdate.toGMTString() + ',path=/'; } else { // Write a new cookie var new_selection = cbId; document.cookie = cookie_name + '=<'+escape(new_selection) + ">,expires="+exdate.toGMTString() + ',path=/'; }
and when I run the "delete cookies" they don't go away, only after I close the browser. I realize I set a 10 day life span,but if you delete them shouldn't they go away? Here is how I delete them.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
function delete_cookie(name) { document.cookie = name+'="";expires=Fri, 14 Oct 2005 12:00:00 UTC;path=/'; }
The
delete_cookie() function is messing up the program. Try doing this: javascript Syntax (Toggle Plain Text)
function delete_cookie(name) { var exp = new Date(); var expdate = exp.setTime( exp.getTime() - 1 ); document.cookie = name + "=; expires=" + expdate + "; path=/"; }
Last edited by essential; Apr 14th, 2009 at 8:10 am.
![]() |
Similar Threads
- Help with automatic update problem and more (Viruses, Spyware and other Nasties)
- Linksys cable gateway and comcast refusing to take my mac # so I can get connectivity (Networking Hardware Configuration)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Div opacity help
- Next Thread: Javascript random image with assigned/accompanying quote
Views: 655 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
acid2 ajax ajaxcode ajaxhelp animate array automatically autoplay beta boarder box bug button calendar captcha card cart codes column cookies createrange() css cursor date debugger decimal design developer dom download dropdown element enter error events firefox firehose flash focus form frameworks getselection google gwt html htmlform iframe image() index java javascript javascripts jawascriptruntimeerror jquery jsp listbox maps marquee masterpage menu microsoft mimic mp3 mp4 offline onmouseover parameters php player post problem programming progressbar prototype rating redirect regex safari scale scriptlets search select size sources sql starrating text textarea toggle twitter validation variables w3c web website window windowofwords windowsxp xml xspf





