Can I close the confirmation window after a time interval?

I need to display this message to the user, where the user can click "Yes" or "No". If the user does not respond after 2 minutes, the window must be closed. Opening a new page is one way. My question is: is it possible to do this using the confirmation window? Can the confirmation window close automatically after 2 minutes?

+7
source share
2 answers

You cannot do this with the native confirm() , since it blocks the execution of JavaScript on this page until the user "answers", but there are many HTML / JavaScript-based add-ons where you can easily add this behavior. <sh> And they often look better. :)

Take a look at https://stackoverflow.com/a/42568/ ... for an example. To create a timeout, you simply window.setTimeout(function() { $('#dialog').dialog('close'); }, 120000); open a dialogue.

+5
source

Alert and Confirm cannot close scripts. Use a modal dialog instead. This usually consists of an absolutely positioned DIV and a translucent overlay that spans the entire page.

+4
source

All Articles