简体   繁体   English

服务器无法访问时如何清除Cookie

[英]How can I clear cookie when server is unreachable

I am using node.js + express server. 我正在使用node.js + express服务器。 And maintaining a session for the login users. 并为登录用户维护会话。

I want to know how does a logged user to logout when the server is unreachable? 我想知道在服务器不可达时如何登录用户?

I know In the normal approach, I can call req.logout() on a request object in the express server. 我知道,在常规方法中,我可以在快速服务器中的请求对象上调用req.logout() And that may clear cookies in the browser and session data on the server. 这可能会清除浏览器中的cookie和服务器上的会话数据。

But what if when the server is unreachable once the user logged in? 但是,如果用户登录后服务器无法访问,该怎么办? How can they log out themselves in the browser ? 他们如何在浏览器中注销自己?

Use the Javascript on the client side as shown here Clearing all cookies with JavaScript 如下所示,在客户端上使用Javascript使用JavaScript 清除所有cookie

Otherwise, if these are session cookies, they will clear when the user close the browser. 否则,如果这些是会话cookie,则当用户关闭浏览器时,它们将被清除。 Any other cookies should be cleared by the user manually using a browser. 用户应使用浏览器手动清除任何其他cookie。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM