W3cubDocs

/Web APIs

Window: showModalDialog() method

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

Non-standard: This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

Warning: This feature has been removed. Please fix your websites 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

js

showModalDialog(uri)
showModalDialog(uri, arguments)
showModalDialog(uri, arguments, options)

Parameters

uri

Is the URL of the document to display in the dialog.

arguments Optional

Values passed to the dialog. property.

options Optional

A 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.

Return value

Holds the returnValue property as set by the document specified by uri.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
showModalDialog 6–43 No 3–56 4 No 5.1–16.4 No No No No No No

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Window/showModalDialog