Ideas:
Use the Mousemover event to monitor whether there is a user Action page, write a timer interval for a specific time to detect if the page is not operating for a long time, and if so, exit;
The specific time code is as follows (JS):
var lasttime = new Date (). GetTime ();
var currenttime = new Date (). GetTime ();
var timeOut = 10 * 60 * 1000; Set timeout time: 10 minutes
$ (document). Ready (function () {
/* Mouse Move Event */
$ (document). MouseMove (function () {
Lasttime = new Date (). GetTime (); Update operation time
});
});
function Testtime () {
CurrentTime = new Date (). GetTime (); Update Current time
if (Currenttime-lasttime > Timeout) {//Determine if timeout
Console.log ("timeout");
}
}
/* Timer interval 1 seconds detect if the page is not operating for a long time */
Window.setinterval (testtime, 1000);
If you do not use JQ can be modified to the corresponding JS
var lasttime = new Date (). GetTime ();
var currenttime = new Date (). GetTime ();
var timeOut = 10 * 60 * 1000; Set timeout time: 10 minutes
Window.onload=function Init () {
Window.document.onmousemove= (function () {
Lasttime = new Date (). GetTime (); Update operation time
}
)};
function Testtime () {
CurrentTime = new Date (). GetTime (); Update Current time
if (Currenttime-lasttime > Timeout) {//Determine if timeout
Console.log ("timeout");
}
}
/* Timer interval 1 seconds detect if the page is not operating for a long time */
Window.setinterval (testtime, 1000);
Web page time-out auto-exit method