You must Sign In to post a response.
  • Category: JQuery

    How to implement TimeOut popup if idle for 15 min?

    Hi,
    I want to show a timeout popup , if user remains idle for 15 min in my application.

    Please let me know how to implement in Javacsript or Jquery or AngularJS
  • #763203
    Hello Jeevan,

    Refer the below code :

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>Popup Sample App</title>
    <script type="text/javascript">
    var timeout = 60; //seconds
    var counter = 0;
    document.onclick = function () {
    counter = 0;
    };
    document.onmousemove = function () {
    counter = 0;
    };
    document.onkeypress = function () {
    counter = 0;
    };
    window.setInterval(CheckIdleTime, 1000);

    function CheckIdleTime() {
    counter++;
    var oPanel = document.getElementById("SecondsUntilExpire");
    if (oPanel)
    oPanel.innerHTML = (timeout - counter) + "";
    if (counter >= timeout) {
    alert("You've been idle for 1 minute!");
    }
    }
    </script>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    </div>
    </form>
    </body>
    </html>

    Hope this will help you. You can change the timeout as per your requirement.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "If you can dream it, you can do it."


  • Sign In to post your comments