Dialog showModal()Method

Dialog 对象参考手册Dialog Object

Example

Show the dialog window:

document.getElementById("myDialog").showModal();

Try it yourself »

Definition and Usage

The showModal() method is used to display the dialog window (shows the dialog).

When this method is used to display a dialog window, the user cannot interact with other elements on the page. If you want the user to still be able to interact with the page while the dialog window is open, you can use the show() method.

Tip:This method is usually used together with theclose()method.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Note:Currently, only Chrome Canary and Safari 6 support the showModal() method.

Note:Even though Chrome Canary supports the <dialog> element, you must open chrome://flags in the Chrome address bar and enable the "Enable experimental Web Platform features" flag. After enabling it, you need to restart the Chrome browser.


Syntax

dialogObject.showModal()


Dialog 对象参考手册Dialog Object

Other Extensions