...

View Full Version : Confirm() timeout



ezra143
05-26-2006, 02:31 AM
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

A1ien51
05-26-2006, 03:00 AM
Look at this:

http://radio.javaranch.com/pascarello/2005/10/25/1130246930301.html

Eric

ezra143
05-26-2006, 03:11 AM
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.

ezra143
05-26-2006, 06:50 AM
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.



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,depende nt=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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum