如何通过使用Javascript来逆转以下执行的效果? [英] How to reverse the effect of the following execution by using Javascript?

查看:328
本文介绍了如何通过使用Javascript来逆转以下执行的效果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

如何使用Javascript删除Cookie?





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

如何通过编写另一个Javascript语句来消除上述语句的结果?

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

推荐答案

要删除cookie,请执行相同的操作,但在过去设置过期日期:

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

在这种情况下:


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

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"

关键是添加 expires = Thu,1970年01月01日00:00: 01 GMT;

这篇关于如何通过使用Javascript来逆转以下执行的效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆