Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- Erase subdomain cookies


Hissingsid - 2:16 pm on Apr 19, 2012 (gmt 0)


I've cobbled together a solution that is working in Chrome and Firefox, I've not tried it in other browsers yet.

This in the page head:
function delete_cookie ( cookie_name )
{
document.cookie = cookie_name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/; domain=.mydomain.com;";
}


This on page:
<a href="#" onclick= "delete_cookie('__utma');delete_cookie('__utmb');delete_cookie('__utmc');delete_cookie('__utmz';">Clear Cookies</a>

Seems to be working reliably.


Thread source:: http://www.webmasterworld.com/javascript/4442970.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com