Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Alert Box Timer

fuzziefuzzie Posts: 7Member
I have created an alert box to appear after 10 mins. warning the user that they will be logged out within 5 mins if they don't press OK. My problem is that I don't know how to trigger an event to send the user to a page telling them that the 5 mins has passed without user interaction. if i walk away and come back 30 mins later the alert box is still there waiting for me to push a button. any ideas? a a different method to get the same result.

Comments

  • ArashSayadiArashSayadi Posts: 10Member
    : I have created an alert box to appear after 10 mins. warning the user that they will be logged out within 5 mins if they don't press OK. My problem is that I don't know how to trigger an event to send the user to a page telling them that the 5 mins has passed without user interaction. if i walk away and come back 30 mins later the alert box is still there waiting for me to push a button. any ideas? a a different method to get the same result.
    :

    I suggest accomplishing the task differently. Why don't you open another small browser window and detect whether it has been closed from the main window.

    It would work like this: In the new window (the confirmWin) have a form with an OK button that will close that window when pressed. Once the confirmWin is closed, in your main window you can detect it and keep the user logged on. Otherwise, you can logout the user AND close the window you opened.

    I wrote up a sample for you to look at.

    The main page from which you would alert the user about their inactivity would look something like this:




    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">



    Untitled







    This is the page that will open the pop up asking the user to press OK if they want to remain logged in.







    I've set the two timeouts to 5 and 10 seconds at the top of this page. You will want to change that to your own specs.



    And the pop up window would look something like the following:


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">



    Untitled


    function userIsActive()
    {
    window.clearTimeout( window.opener.inactiveTimer );
    window.clearTimeout( window.opener.logoutTimer );

    window.opener.isUserInactive();

    window.close();
    }














    If you wish to remain logged in, please press the OK button within 5 seconds.
     







    I hope that helps. Let me know if you have problems with the script.




    Happy Computing,
    Arash Sayadi
    15530-B Rockfield Blvd. Suite 4
    Irvine, CA 92618
    949-830-1623 x36
    949-830-2120 Fax
    www.pts1.com
    arashs@pts1.com


Sign In or Register to comment.