如何检测用户是否“空闲”用javascript? [英] How do i detect if the user is "idle" with javascript?

查看:134
本文介绍了如何检测用户是否“空闲”用javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个实时Web应用程序,每10秒向服务器发送AJAX请求。显然这是非常带宽密集的,我想知道是否有任何解决方案。

I'm developing a "real-time" web application which sends AJAX requests to the server every 10 seconds. Obviously this is very bandwidth-intensive and I would like to know if there's any solution to this.

我的想法是检查用户是否没有将鼠标移动X秒。我如何才能实现这一点?

My idea is checking if the user doesn't move his mouse for X seconds. How can I accomplish this?

推荐答案

我想你正在寻找: https://github.com/jasonmcleod/jquery.idle

这篇关于如何检测用户是否“空闲”用javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆