magnetica Posted April 7, 2007 Share Posted April 7, 2007 I have tried many examples of how to delete cookies with javascript but none seem to work. I'm not great at javascript but heres what I have:- function delete_cookie ( cookie_to_delete ) { var cookie_date = new Date ( ); // current date & time cookie_date.setTime ( cookie_date.getTime() - 1 ); document.cookie = cookie_to_delete += "=; expires=" + cookie_date.toGMTString(); } I then call it on the page load like so: <body onload="deleteCookie"> Can anyone explain why its not working? Or please provide me with an example that does, Thanks a lot Link to comment https://forums.phpfreaks.com/topic/46004-deleting-cookies-doesnt-seem-to-work/ Share on other sites More sharing options...
Vikas Jayna Posted April 7, 2007 Share Posted April 7, 2007 Well The following things are to be looked at:- 1) the function name is delete_cookie but the call to the function is deleteCookie. 2) also the function requires a parameter cookie_to_delete and no parameter is being passed to the function. Link to comment https://forums.phpfreaks.com/topic/46004-deleting-cookies-doesnt-seem-to-work/#findComment-223538 Share on other sites More sharing options...
tarun Posted April 7, 2007 Share Posted April 7, 2007 Yep Vikas Is Right It Should Be <body onload="delete_cookie(CookieName);"> Topic Solved...? Link to comment https://forums.phpfreaks.com/topic/46004-deleting-cookies-doesnt-seem-to-work/#findComment-223688 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.