本文介绍了按名称删除Cookie?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何删除名为 roundcube_sessauth 的特定Cookie?

How can I delete a specific cookie with the name roundcube_sessauth?

不应包含以下内容: / p>

Shouldn't the following:

function del_cookie(name) {
    document.cookie = 'roundcube_sessauth' +
    '=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
}

然后:

<a href="javascript:del_cookie(name);">KILL</a>



杀死 roundcube_sessauth 饼干吗?

推荐答案

为了删除一个cookie设置终止日期过去的东西。这是否将是一个功能。

In order to delete a cookie set the expires date to something in the past. A function that does this would be.

var delete_cookie = function(name) {
    document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
};



然后删除名为cookie的 roundcube_sessauth 刚do。

delete_cookie('roundcube_sessauth');

这篇关于按名称删除Cookie?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 11:41
查看更多