Nossos voluntários ainda não traduziram este artigo para o Português (do Brasil) . Junte-se a nós e ajude a fazer o trabalho!
Deprecated
This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.
The Window.showModalDialog()
creates and displays a modal dialog box containing a specified HTML document.
This feature is going away. Please fix your Web sites and applications.
Support has been removed in Chrome 37. But they have added a temporary Enterprise Policy setting to re-enable showModalDialog. This showModalDialog() method was removed completely in Chrome 43.
Mozilla has announced that it will remove support for this method (bug 981796). Regarding timing, it shouldn't be before Firefox 46. This means that the function will be around until around mid-June 2016. An ESR release may support it for some more months.
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 byuri
.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 thewindow
object'swindow.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 . |
dialogHide
, edge
, status
, or unadorned
arguments.Browser compatibility
Introduced by Microsoft Internet Explorer 4. Support added to Firefox in Firefox 3 (deprecated in Fx 28), and to Safari in Safari 5.1. See WebKit bug 151885 for possible future removal from Safari.
Examples
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
See also
<dialog>
, a replacement forwindow.showModalDialog()
.- showModalDialog Polyfill using a
<dialog>
and generators