有没有办法检测用户在网站中的非活动时间? (空闲时间)

发布于 2024-08-23 09:15:26 字数 77 浏览 2 评论 0原文

这是我的方法:我保留上次用户在会话中向服务器发布回发的时间,并在每次回发中从当前值中减去该值。有更好的方法吗?我认为我的方法没有很好的表现。

This is my approach : I reserve last time that a user post a postback to server in a session and in every postback subtract this value from current value. Is there a better way for this? I think that my approach haven't a good performance.

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

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

发布评论

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

评论(1

像极了他 2024-08-30 09:15:26

如果您使用进程内会话,则会话超时时会触发一个事件。

最后,类似的事情都需要定期查看当前时间和会话中最后记录的活动之间的差异。

If you are using in process sessions, there is an event that is fired when the session times out.

In the end anything like this involves regularly looking at the difference between the current time and the last recorded activity in the session.

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