views:

7707

answers:

1
javascript:void(document.cookie=”PREF=ID=20b6e4c2f44943bb:U=4bf292d46faad806:TM=1249677602:LM=1257919388:S=odm0Ys-53ZueXfZG;path=/; domain=.google.com”);

How to eliminate the result of the statement above by writing another Javascript statement?

A: 

To remove a cookie, do the same thing but set an expire date in the past:

In this case:

document.cookie=”PREF=ID=20b6e4c2f44943bb:U=4bf292d46faad806:TM=1249677602:LM=1257919388:S=odm0Ys-53ZueXfZG; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/; domain=.google.com”

The key is the addition of expires=Thu, 01 Jan 1970 00:00:01 GMT;

stefpet
javascript:void(document.cookie=”PREF=ID=20b6e4c2f44943bb:U=4bf292d46faad806:TM=1249677602:LM=1257919388:S=odm0Ys-53ZueXfZG;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/; domain=.google.com”); does not work.
Steven
Your cookie domain is .google.com, if you're not actually running the code from that domain you will not be able to modify the cookie.
stefpet