How to reverse the effect of the following execution by using Javascript? [duplicate]

StackOverflow https://stackoverflow.com/questions/1802275

  •  05-07-2019
  •  | 
  •  

Question

Possible Duplicate:
How to remove a cookie by using Javascript?

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?

Was it helpful?

Solution

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;

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top