跨浏览器窗口关闭事件

发布于 2024-09-04 08:19:04 字数 474 浏览 1 评论 0原文

可能的重复:
关闭浏览器或选项卡时关闭/终止 seesion< /a>

有跨浏览器事件的解决方案吗?我需要检查用户是否关闭了窗口并向我的数据库发出 ajax 请求以将其注销。

我已经查看了所有人,但大多数情况下它不适用于所有浏览器。有人有解决办法吗?或者如何执行此操作的替代方案可能是取决于浏览器的条件语句?

谢谢!

Possible Duplicate:
Close /Kills the seesion when close the browser or tab

Is there a solution for cross browser event. I need to check if user closes their window and to throw an ajax request to my database to sign them out.

I've looked everyone but most cases its not working in all browsers. Anyone have a solution? Or Alternative on how to do this perhaps a conditional statement depending on the browser?

Thanks!

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

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

发布评论

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

评论(1

银河中√捞星星 2024-09-11 08:19:04

我认为这样的事情不存在。您可以尝试 onunload,但刷新页面时也会触发。这个问题一直是许多想要做你所要求的事情的人的祸根。

I don't think such a thing exists. You can try an onunload, but that also fires when you refresh the page. This question has been the bane of many that want to do what you're asking for.

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