JS based on the mouse and keyboard to determine whether the page has not been operating for a long time

Source: Internet
Author: User

<script>varCount = 0; varouttime=30;//minutesWindow.setinterval (Go, 1000); functionGo () {count++; if(Count = = outtime*60{alert ("You have expired the page due to a prolonged period of operation");            }        }        Try {            varx =Event.clientx; vary =Event.clienty; } Catch(e) {}//Monitor MouseDocument.onmousemove =function () {            varX1 =Event.clientx; varY1 =Event.clienty; if(x! = X1 | | Y! =y1) {Count= 0; } x=X1; Y=Y1;        }; //Monitor KeyboardDocument.onkeydown =function() {count= 0;    }; </script>

JS Determines whether the page is not working for a long time based on the mouse and keyboard

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.