browse: forums | FAQ
Connecting Tech Pros Worldwide

Hey there! Do you need JavaScript / Ajax / DHTML help?

Get answers from our community of JavaScript / Ajax / DHTML experts on BYTES! It's free.

Timeout question

Pink Pig
Guest
 
Posts: n/a
#1: Mar 6 '07
I apologize if this question has been asked and answered before. Is
there a way to set a timeout on a window.confirm() call? I want to ask
the user something, but if he doesn't respond within a certain period
of time, I want to treat it the same as if he had clicked Cancel. I
tried using setTimeout() for this, but apparently setTimeout() isn't
checked while a confirm window is open.




Evertjan.
Guest
 
Posts: n/a
#2: Mar 6 '07

re: Timeout question


Pink Pig wrote on 06 mrt 2007 in comp.lang.javascript:
Quote:
I apologize if this question has been asked and answered before. Is
there a way to set a timeout on a window.confirm() call? I want to ask
the user something, but if he doesn't respond within a certain period
of time, I want to treat it the same as if he had clicked Cancel. I
tried using setTimeout() for this, but apparently setTimeout() isn't
checked while a confirm window is open.
>
>
No.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Darko
Guest
 
Posts: n/a
#3: Mar 7 '07

re: Timeout question


On Mar 6, 11:00 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
Quote:
Pink Pig wrote on 06 mrt 2007 in comp.lang.javascript:
>
Quote:
I apologize if this question has been asked and answered before. Is
there a way to set a timeout on a window.confirm() call? I want to ask
the user something, but if he doesn't respond within a certain period
of time, I want to treat it the same as if he had clicked Cancel. I
tried using setTimeout() for this, but apparently setTimeout() isn't
checked while a confirm window is open.
>
No.
>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
You'll have to simulate confirm() call by making a new window with the
given message and button.

Dr J R Stockton
Guest
 
Posts: n/a
#4: Mar 7 '07

re: Timeout question


In comp.lang.javascript message <1173212825.252169.56560@h3g2000cwc.goog
legroups.com>, Tue, 6 Mar 2007 12:27:05, Pink Pig <bill.daly@tradition-
ny.composted:
Quote:
>I apologize if this question has been asked and answered before. Is
>there a way to set a timeout on a window.confirm() call? I want to ask
>the user something, but if he doesn't respond within a certain period
>of time, I want to treat it the same as if he had clicked Cancel. I
>tried using setTimeout() for this, but apparently setTimeout() isn't
>checked while a confirm window is open.
Does it have to be a confirm()? If you cannot build your own similar
window, you could use yes/no buttons in a small Form, and by program set
the background to be conspicuous during the active interval and disable
or hide the buttons or form outside the interval.

But that would be an undesirable thing to do in a general application,
where the user's attention may be called to another matter at any time.

It's a good idea to read the newsgroup and its FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Randy Webb
Guest
 
Posts: n/a
#5: Mar 7 '07

re: Timeout question


Darko said the following on 3/7/2007 9:47 AM:
Quote:
On Mar 6, 11:00 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
Quote:
>Pink Pig wrote on 06 mrt 2007 in comp.lang.javascript:
>>
Quote:
>>I apologize if this question has been asked and answered before. Is
>>there a way to set a timeout on a window.confirm() call? I want to ask
>>the user something, but if he doesn't respond within a certain period
>>of time, I want to treat it the same as if he had clicked Cancel. I
>>tried using setTimeout() for this, but apparently setTimeout() isn't
>>checked while a confirm window is open.
>No.
>>
You'll have to simulate confirm() call by making a new window with the
given message and button.
Are you sure that "have to" is appropriate? You don't have to. You can
always simulate a confirm box with an in page pop-up and not have to
worry about popup blockers blocking the unwanted window.

<URL: http://www.litotes.demon.co.uk/js_info/pop_ups.html>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Pink Pig
Guest
 
Posts: n/a
#6: Mar 7 '07

re: Timeout question


On Mar 7, 7:15 am, Dr J R Stockton <reply0...@merlyn.demon.co.uk>
wrote:
Quote:
Does it have to be a confirm()? If you cannot build your own similar
window, you could use yes/no buttons in a small Form, and by program set
the background to be conspicuous during the active interval and disable
or hide the buttons or form outside the interval.
No, it doesn't have to be a confirm(), but I was hoping to avoid a
heavy-duty learning curve<g>.
Quote:
But that would be an undesirable thing to do in a general application,
where the user's attention may be called to another matter at any time.
Let me explain in more detail. (And keep in mind that I don't have
much experience with this sort of thing.) I'm trying to help my son-in-
law, whose website keeps locking up several times a day. One of my
guesses as to the reason is that a lot of users don't bother to log
out when they are done, they just switch to doing something in another
window or go off to watch TV or something. So I wanted to implement
something that would log them out if they were no longer using the
website, but I wanted to be polite about it. Specifically, after 30
minutes, I want to pop up a window that asks "Do you need more time?",
and if they either say no or don't respond at all, I want to log them
out (quietly). Presumably, if they have either switched to a new
window or left the machine altogether, they won't see this alert, so
they won't respond. I've been looking for ways to do this, but without
luck so far.
Quote:
It's a good idea to read the newsgroup and its FAQ. See below.
I went through the FAQ, but didn't find anything that appeared to
address the issue. There are far too many threads here for me to have
read them all. I'll try to catch up, but for all I know the thread
which specifically touches on this is from the 20th century<g>.

Thanks for your attention.

scripts.contact@gmail.com
Guest
 
Posts: n/a
#7: Mar 7 '07

re: Timeout question


On Mar 7, 8:47 am, "Darko" <darko.maksimo...@gmail.comwrote:
Quote:
Quote:
Quote:
but apparently setTimeout() isn't
checked while a confirm window is open.
>
Quote:
You'll have to simulate confirm() call by making a new window with the
given message and button.
if you have to use something different, then a better option is two
floating divs. One that shows the message. 2nd (transparent) that will
hide the background (that will also disable selecting elements and
clicking links).

Walton
Guest
 
Posts: n/a
#8: Mar 7 '07

re: Timeout question


Let me explain in more detail. (And keep in mind that I don't have
Quote:
much experience with this sort of thing.) I'm trying to help my son-in-
law, whose website keeps locking up several times a day. One of my
guesses as to the reason is that a lot of users don't bother to log
out when they are done, they just switch to doing something in another
window or go off to watch TV or something. So I wanted to implement
something that would log them out if they were no longer using the
website, but I wanted to be polite about it. Specifically, after 30
minutes, I want to pop up a window that asks "Do you need more time?",
and if they either say no or don't respond at all, I want to log them
out (quietly). Presumably, if they have either switched to a new
window or left the machine altogether, they won't see this alert, so
they won't respond. I've been looking for ways to do this, but without
luck so far.
This isn't the sort of thing you want to do in javascript. Imagine if
a website kept pestering you every x minutes asking if you want to
keep your session alive.

You're probably heading in the wrong direction with the "too many
people not logging out" theory. Http sessions should terminate
automatically after a certain amount of inactivity from the user's
end. The user shouldn't have to explicitly log out for their session
to end.

My first impressions as to what's going on are (these are just
guesses):
-buggy (server-side) code
-server doesn't have enough processing power/memory for what tasks
performed by his website require
-heavy traffic??

I would say look somewhere else for a solution- like server-side web
programming or session programming.


Pink Pig
Guest
 
Posts: n/a
#9: Mar 7 '07

re: Timeout question


On Mar 7, 1:45 pm, "Walton" <jrhol...@gmail.comwrote:
Quote:
This isn't the sort of thing you want to do in javascript. Imagine if
a website kept pestering you every x minutes asking if you want to
keep your session alive.
I was hoping not to pester anybody, but I thought that others might
have worked out a solution that's livable. Well, maybe not. FWIW, if I
set up a timer with setTimeout(), it doesn't intrude on the user -- he
only sees it when the page it was associated with is visible. I figure
that if I could get it to work at all, then I could tune it to reset
the timer whenever the user does something on the site (like type a
key or move the mouse).
Quote:
You're probably heading in the wrong direction with the "too many
people not logging out" theory. Http sessions should terminate
automatically after a certain amount of inactivity from the user's
end. The user shouldn't have to explicitly log out for their session
to end.
Thanks for the suggestion. I thought I might be barking up the wrong
tree.
Quote:
My first impressions as to what's going on are (these are just
guesses):
-buggy (server-side) code
This is very possible. The site was originally written by a couple of
guys who had never done a website before. I've tracked down a few
performance issues, but I suspect there's a bug somewhere that's
causing all the trouble. The PHP code gives new meaning to the term
"spaghetti code".
Quote:
-server doesn't have enough processing power/memory for what tasks
performed by his website require
-heavy traffic??
Less likely. It's not all that big or busy a site, and I'd be very
surprised if the server just can't keep up with the work.

Thanks for the suggestions.

Closed Thread