HTML 5.2 has introduced a new
element to show modal dialog boxes. Here’s a small demo by @bdc :
Already available in Chrome; a polyfill is available for other/older browsers.
Polyfill for the HTML
Siderant: I cannot help it, but my inner geek has issues with the language used to control the dialog. The attribute to indicate whether a modal is open/visible/shown or not is named
open , so I guess that’s the baseline.
modal.showModal() … why
show and not
open to be in line with the HTML attribute? And why the
And now comes the even more inconsistent part: to close it, you don’t call
(which is the exact opposite of