java session问题
PHPz
PHPz 2017-04-18 09:21:12
0
1
198

对于一个网页长时间没有操作,给用户一个对话框的提示,但是用户的基本信息还是可以获取到;有没有办法实现

PHPz
PHPz

学习是最好的投资!

reply all(1)
刘奇

Is it more appropriate to do it on the front end?

The front-end js is used as a monitor. If there is neither mouse operation nor keyboard operation for a long time (for example: 30 minutes), a box will pop up to remind the user.

Correction:

What I gave before was pseudo-code, which was only meaningful and not guaranteed to be correct, but the questioner obviously took it seriously, so I had no choice but to change it a little bit, at least it can run

For example:

var timer;

var setTimer = function(){
    timer = setTimeout(function() {
        alert('你大爷的,也不动一动?');
        setTimer();
    }, 5000);
};

setTimer();

var handler = function(){
    clearTimeout(timer);
    setTimer();
};

document.addEventListener('keyup', handler, false);
document.addEventListener('mousemove', handler, false);
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template