(JQuery) Jump to the login page when there is no action on the page's usual time

Source: Internet
Author: User

The premise is that users can't help scripting

If so, try to use each page as much as possible.
$ (function () {
var timenum = new Date (). GetTime ();
MouseDown () monitors whether the mouse uses KeyDown () to monitor whether the keyboard is available
$ (document). MouseDown (function () {
Timenum = new Date (). GetTime ();
}). KeyDown (function () {
Timenum = new Date (). GetTime ();
});
SetInterval used to judge the difference in the current time
SetInterval (function () {
This determines whether the button or mouse event triggered
var timecount = new Date (). GetTime ();
var minutes = Math.floor ((timecount-timenum)/(60 * 1000));
If two time difference is greater than 1 minutes
if (minutes >= 30) {
window.location.href = ' login.html ';
}
}, 1000);
})

(JQuery) Jump to the login page when there is no action on the page's usual time

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.