How to detect idle time in JavaScript elegantly?

前端 未结 30 2418
别跟我提以往
别跟我提以往 2020-11-21 11:51

Is it possible to detect \"idle\" time in JavaScript?
My primary use case probably would be to pre-fetch or preload content.

Idle time:

30条回答
  •  闹比i
    闹比i (楼主)
    2020-11-21 12:55

    Here is a simple script using JQuery that handles mousemove and keypress events. If the time expires, the page reload.

       
    

提交回复
热议问题