nodejsHow to delete client cookies.
I made two interfaces.
A cookie will be set on the page after accessing interface a.
The cookie will be deleted after the b interface is accessed.
But my b interface cannot be deleted
res.setHeader("Set-Cookie", ["id="]);
I can clear it using this method, but the client will still leave fields like id=. Is there any way to delete it directly?
世界只因有你2017-06-05 11:15:11
function delete_cookie( name ) {
document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
}
怪我咯2017-06-05 11:15:11
You can only make it invalid immediately by setting the expiration time
res.cookie(prop, '', {expires: new Date(0)});