网页中的会话。如何自动退出

发布于 2024-09-12 09:58:05 字数 190 浏览 5 评论 0原文

当我们在一个选项卡中登录 gmail 并在另一个选项卡中登录 orkut 时(请记住,两者只能是同一帐户。登录一个选项卡会自动登录到另一个选项卡)。如果我们从 gmail 注销,然后转到 orkut 已打开的选项卡,则在页面中保留几秒钟后,页面会自动注销。这是怎么做到的?我认为这是通过页面刷新实现的,但想知道有什么更好的方法,因为我不想一次又一次地传输这么多数据。

When we sign into gmail in one tab and orkut in another(remember both can only be of the same account. Logging into one automatically logs into another). if we log out from gmail and then go to the tab in which orkut is already open, after remaning in the page for a few seconds the page automatically logs out. How is this done? i assume this is through page refresh but would like to know of any better way since i dont want to transfer so much data again and again.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼藏柔 2024-09-19 09:58:05

Google 的单点登录服务器知道您的帐户已注销,因此下次任何 Google 服务验证您的凭据时,它都会返回您已注销的信息,以便应用程序可以采取相应的操作。

至于如何在不刷新整个页面的情况下做到这一点,很可能是 XHR(AJAX 请求)实际上使页面注销。这可能不是一个明确的“检查凭据”请求,而是这些应用程序默认编写的任何常规请求(在 GMail 上检查电子邮件、在 Orkut 上检查新朋友或其他内容)触发凭据检查。

Google's Single Sign On server knows that your account has been logged out, so next time any Google service validates your credentials, it returns that you've logged out so the app can act accordingly.

And about how to do it without having to refresh the whole page, it's very likely a XHR (AJAX request) which actually makes the page log out. It's probably not an explicit 'check for credentials' request, but any regular request that those apps have programmed by default (check for email on GMail, check for new friends or whatever on Orkut) that triggers the credentials check.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文