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()
created and displayed a modal dialog box containing a specified HTML document.
Syntax
returnVal = window.showModalDialog(uri[, arguments][, options]);
returnVal
holds thereturnValue
property as set by the document specified byuri
.uri
is the URL of the document to display in the dialog.arguments
is an optional variant containing values passed to the dialog; these are made available in thewindow
object'swindow.dialogArguments
property.options
is an optional string specifying window ornamentation for the dialog, using one or more semicolon delimited values:
Syntax | Description |
---|---|
center: {on | off | yes | no | 1 | 0 } |
If on , yes , or 1 , the dialog window is centered on the desktop; otherwise it's hidden. Default is yes . |
dialogheight: height |
The height of the dialog box in pixels. |
dialogleft: left |
Distance of the dialog box from the left edge of the desktop. |
dialogwidth: width |
The width of the dialog box in pixels. |
dialogtop: top |
Distance of the dialog box from the top edge 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 on , yes , or 1, the dialog window has scroll bars; otherwise its size is fixed. Default is no . |
Note: Firefox does not implement the
dialogHide
, edge
, status
, or unadorned
arguments.Examples
Notes
showModalDialog()
was briefly standardized as part of HTML5. The third argument for additional options was not present in the HTML5 version.
Specification
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
showModalDialog | Chrome No support ? — 43 | Edge No support No | Firefox No support 3 — 56 | IE Full support 4 | Opera No support No | Safari
Full support
5.1
| WebView Android No support No | Chrome Android No support No | Firefox Android No support No | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
Legend
- Full support
- Full support
- No support
- No support
- Non-standard. Expect poor cross-browser support.
- Non-standard. Expect poor cross-browser support.
- Deprecated. Not for use in new websites.
- Deprecated. Not for use in new websites.
- See implementation notes.
- See implementation notes.
See also
<dialog>
, a replacement forwindow.showModalDialog()
.- showModalDialog Polyfill using a
<dialog>
and generators