javascript:(function(){C=window.cookie.s
for(d="."+location.host;
d;
d=(""+d).substr(1).match(//..*$/))
for(sl=0;sl<2;++sl)
for(p="/"+location.pathname;
p;
p=p.substring(0,p.lastIndexOf('/')))
for(i in C)
if(c=C[i]){window.cookie=c+"; domain="+d.slice(sl)+";
path="+p.slice(1)+"/"+";
expires="+new Date((new Date).getTime()-1e11).toGMTString()}})()
alert('Cookies deleted')
I know that Safari (which is what I'm using) uses 'window' instead of 'document'. But I don't know why this bookmarklet isn't working. (It is supposed to make all the cookies from the site you are currently visiting expire.)
I've looked (briefly) for a place that simply defines all the objects and sub-objects and the commands that can be used on them in javascript, but I can't find one. (I don't even know if object, sub-object and command are the correct terms. They probably aren't. I mean the things like 'window' and 'window.cookie' and 'window.cookie.split', respectively.)
I'm not even sure I'm parsing the statement correctly. I don't know when the "for" statements end, or the "if" statements.
Any help? Where can I just find a simple definition of everything? Everywhere I go tries to give me a tutorial on javascript, which I don't want. I want something about bookmarklets.
November 8 2005, 20:34:08 UTC 6 years ago
When I throw this into a javascript editor, it complains about the +"; on line 10, and the whole section on line 12 after expires="+ (numbered line below). Maybe the +" and the "+ were on teh same line at some point? Try removing them - my editor stops complaining :)
-- Mieke.
1 javascript:(function(){C=window.cookie.s
2 for(d="."+location.host;
3 d;
4 d=(""+d).substr(1).match(//..*$/))
5 for(sl=0;sl<2;++sl)
6 for(p="/"+location.pathname;
7 p;
8 p=p.substring(0,p.lastIndexOf('/')))
9 for(i in C)
10 if(c=C[i]){window.cookie=c+"; domain="+d.slice(sl)+";
11 path="+p.slice(1)+"/"+";
12 expires="+new Date((new Date).getTime()-1e11).toGMTString()}})()
13
14 alert('Cookies deleted')