Can a modal JavaScript dialog be modal only for a tab, and not for the entire browser window?

Modern browsers have an interface with multiple tabs, but the JavaScript window.showModalDialog() function creates a modal dialog box that blocks all tabs.

I would like to know if there is a way to create a modal dialog box that only locks the tab in which it was created?

+6
javascript modal-dialog
source share
3 answers

You can use one of the more β€œAjax-like” modal dialogs, which are just absolute positional divs floating on top of everything else.

It is modal to the "document" and not to the browser.

For example, check out this jQuery plugin.

PS showModalDialog() is just an IE call, so you may not use it at all.

+8
source share

Nope. It is possible that this may happen at some point, but in current beta versions this could lead to weakening the connection of IE8.

Michiel's second recommendation. A pseudo-modal dialog, working by obscuring the rest of the page, floating the div on top and invoking the script back when it ends, is as follows:

  • much more comfortable / less annoying than real modal dialogue
  • compatible with any browser

showModalDialog / showModelessDialog should generally be avoided.

+2
source share

Firefox 3 supports window.showModalDialog (but it also blocks all tabs).

+1
source share

All Articles