User Stay site No operation, a certain time after the automatic exit

Source: Internet
Author: User

1. General Page

function Checkuserfun () {    var maxtime = 2*60*60;//Seconds  (2 hours)    var time = maxtime;    $ (' body '). On (' KeyDown mousemove mousedown Click Scroll ', function (e) {Time        = maxtime;//Reset    });    var intervalid = setinterval (function () {        time--;         < = 0 ) {            showinvalidloginmessage ();            Clearinterval (Intervalid);        }    },1000)    function showinvalidloginmessage () {
Clear User Information alert (' invalid page, please login again '); Jump to login page }}

2. The page with the IFRAME embedded

var maxtime = 2*60*60;//Secondsvar time = Maxtime;function Checkuserfun () {$ (' body '). On (' KeyDown MouseMove Mousedow  n Click Scroll ', function (e) {time = MaxTime;//reset});      $ ($ (' #ifr ') [0].contentwindow]. On (' Click Scroll keydown mousemove mousedown ', function (e) {time = MaxTime;//Reset  Load ();  });      var intervalid = setinterval (function () {time--; if ( time<= 0) {showinvalidloginmessage ();      Clearinterval (Intervalid);    }},1000) function Showinvalidloginmessage () {Delcookie (' username '); Location.href= ' login.html '; }}function Load () {$ ($ (' #ifr ') [0].contentwindow). On (' Click Scroll keydown mousemove mousedown ', function (e) {time = MaxTime;//reset}); time= MaxTime;//Reset}

Html

<id= "IFR"  src= "banner/bannerlist.html"  frameborder = "0" width = "100%" Height = "100%"  = "load ()"></iframe>

User Stay site No operation, a certain time after the automatic exit

Related Article

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.