Is there a way using JavaScript or jQuery to detect if a confirm or alert box is being displayed?

Edit
Report