We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Custom Alert / Confirm which waits for button click..?

Gaizka80 asked
Medium Priority
Last Modified: 2008-02-01
I've been searching an answer for this question for a while. Still not getting any working solution..
To make mine web application UI and style comfortable, I've created my own alert- and confirm-boxes using
instructions at:

It works fine, if I don't want to redirect user after confirming the message with OK or Cancel.
It doesn't matter if I use custom alert or confirm, problem appears in both cases.
setTimeOut function or any other JS delay solution doesn't appear to work to freeze the application on alert-box.
It always disappears and redirects browser before clicking either OK or Cancel.

How can I possible force the JS application wait for user to click alert/confirm buttons??!
Is this even possible.. Any other "solutions" in this site doesn't seem to work..
Watch Question

Top Expert 2004

Can't you put your redirect code into the




I figured out that solution also by myself.

If I still would like to use custom alert like native JS alert i still need some kind of wait-function..
Is it possible?!

if ( customConfirm('Sure?') ) {
  // Do something

So can I make customConfirm wait for button click and use it as above?
Top Expert 2004
>>  I figured out that solution also by myself.

Ah, ok...

I don't think that code will do it...  Have you seen this though?


It might work better?


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


I tried that subModal-dialog, thank you for the link.

It's partly based on the same idea as customAlert, and it would possibly be better
solution if I need to show a lot of information (as in link page example) in modal window - I don't.

This modal window, as I tested it in practice, seems to be considerable slower than using customAlert.
I want my applications user actions to happen immediately. When using modal dialog, it seems just as it loads to another page.
It seems to have some scrolling problems too, that I already solved in my customAlert case.

Now that my customAlert & -Confirm seems to work well, I decide to remain on that solution too.
That subModal is still worth trying in some other case, it looks great.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.