W3cubDocs

/DOM

window.showModalDialog

Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

This feature has been removed. Please fix your Web sites and applications.

This method was removed in Chrome 43, and Firefox 56.

The Window.showModalDialog() creates and displays a modal dialog box containing a specified HTML document.

Syntax

returnVal = window.showModalDialog(uri[, arguments][, options]);

where

  • returnVal is a variant, indicating the returnValue property as set by the window of the document specified by uri.
  • uri is the URI of the document to display in the dialog box.
  • arguments is an optional variant that contains values that should be passed to the dialog box; these are made available in the window object's window.dialogArguments property.
  • options an optional string that specifies window ornamentation for the dialog box, using one or more semicolon delimited values:
Syntax Description
center: {on | off | yes | no | 1 | 0 } If this argument's value is on, yes, or 1, the dialog window is centered on the desktop; otherwise it's hidden. The default value is yes.
dialogheight: height Specifies the height of the dialog box; by default, the size is specified in pixels.
dialogleft: left Specifies the horizontal position of the dialog box in relation to the upper-left corner of the desktop.
dialogwidth: width Specifies the width of the dialog box; by default, the size is specified in pixels.
dialogtop: top Specifies the vertical position of the dialog box in relation to the upper-left corner of the desktop.
resizable: {on | off | yes | no | 1 | 0 } If this argument's value is on, yes, or 1, the dialog window can be resized by the user; otherwise its size is fixed. The default value is no.
scroll: {on | off | yes | no | 1 | 0 } If this argument's value is on, yes, or 1, the dialog window has scroll bars; otherwise its size is fixed. The default value is no.
Note: Firefox does not implement the dialogHide, edge, status, or unadorned arguments.

Examples

Try out showModalDialog().

Notes

showModalDialog() is currently being standardized as part of HTML5. The third argument (for additional options) is not present in the HTML5 version, and is (safely) ignored by both Safari and Chrome.

Specification

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support ? — 43 No 3 — 56 4 No 5.1
5.1
See WebKit bug 151885 for possible future removal from Safari.
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support No No No No No No No

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/window/showModalDialog