1function deleteAllCookies() {
2 var cookies = document.cookie.split(";");
3
4 for (var i = 0; i < cookies.length; i++) {
5 var cookie = cookies[i];
6 var eqPos = cookie.indexOf("=");
7 var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
8 document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
9 }
10}
11
12deleteAllCookies();
1function deleteCookie(name) {
2 document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
3}
1//set the vvalue to EMPTY, and the date to an already PASSED one.
2document.cookie = "cookiename= ; expires = Thu, 01 Jan 1970 00:00:00 GMT"
1document.cookie = 'my_cookie=; path=/; domain=.example.com; expires=' + new Date(0).toUTCString();
1
2document.cookie = "username=; expires=Thu, 01
3Jan 1970 00:00:00 UTC; path=/;";
4