Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Confirm() timeout

    Is there are way for this to happen:

    A while loop presents a confirm() dialog when a value reaches, say 500, and continues to recurse down to 0 without waiting for input from a user?

    What I need to do, ideally without using a popup window, is to present a user with an option of extending thier login session while continuing to countdown to expiration. I just can seem to keep executing the script or timer without input from the user. I want extending thier session to be option for the sake of security. If they walk away and dont respond, it needs to log them out.

    Again, I know I can do this with a popup. But, I dont want to have to worry about popup blockers and such.

    TIA

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New to the CF scene
    Join Date
    May 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks,

    I had considered using either a layer or div to produce the warning.

    While I guess I could have the window get focus when this occurs. I was worried about the browser being minimized or out of focus when this occured, hence the confirm dialog on focus.

    While I consider myself to be ok with javascript, I dont know of anyway to call another function AND continue running the function that called it in parallel.

    I have also run into the same problem with php, no parallel processes. I guess it is time for new languages.

    EDIT: Tried what you suggested, and remembered the one thing that stopped me from doing it before: if it is a large page, it is dependent on where the user on the page, they may never see the layer. I'd rather not have 100 lines of javascript to do the css fixed property in IE. It would be nice if IE supported fixed div's.
    Last edited by ezra143; 05-26-2006 at 06:52 AM.

  • #4
    New to the CF scene
    Join Date
    May 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Solution, kinda.

    I decided to use a popup called on an interval and a hidden for field on the window.opener that is set to 0 initially and set to 1 by the popup when an extension is requested. Redirect is called onLoad.

    Code:
    function Redirect()
    	{
    		var id=setTimeout( "logout()", 60*900 );
    		var id2=setTimeout( "alertTime()", 60*600 );
    	}
    function alertTime()
    	{
    		var url = "confirm.html";
    		var settings="height=200,width=200,scrollbars=no,toolbar=no,location=no,status=no,menubar=no,resizable=yes,dependent=no'";
    		newwindow=window.open(url,'Alert',settings);
    		if (window.focus) {newwindow.focus()}
    	}
    
    function logout()
    	{
    				
    	var keepalive = document.kaff.elements[0].value;
    	if(keepalive == 1)
    	     {
    		clearTimeout('id');
    		clearTimeout('id2');
    		document.kaff.elements[0].value='0';
    		Redirect();
    	      }
    	else
    	      {
    		window.location.href = sTargetURL;
    	      }
    	}
    it is by no means elegant, but it is a viable solution for the time being.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •