node.js - nodejs how to delete client cookies
漂亮男人
漂亮男人 2017-06-05 11:13:11
0
2
726

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?

漂亮男人
漂亮男人

reply all (2)
世界只因有你
function delete_cookie( name ) { document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'; }
    刘奇

    You can only make it invalid immediately by setting the expiration time
    res.cookie(prop, '', {expires: new Date(0)});

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!