views:

29

answers:

1

How to disable or clear the client browser Cookies using any technology

may i think using javascript it will be usable to any techonology

+2  A: 
var cookies = document.cookie.split(";");

for (var i = 0; i < cookies.length; i++)

  eraseCookies(cookies[i].split("=")[0]);

Note: there is no perfect solution to remove all the cookies.You can only remove cookies created by JavaScript - if a cookie was create by the server, then you cannot remove it through JavaScript cause cookies are uniquely identified by not just by their key "name" but also their "domain" and "path" and this info is not available using document.cookie

piemesons
First of all, this won't work at all. There is no such method as eraseCookies. Perhaps it was left out from your answer?Second, the domain/path the javascript code is executed from determines which cookies it will receive/have access to. You can erase cookies from another domain/path, if they both share the second level domain. Erasing cookies is a matter of assigning a blank cookie value and an expires property of -1.
thomask