niutech / showModalDialog

window.showModalDialog polyfill using a <dialog> element
https://niutech.github.io/showModalDialog/demo.html
Apache License 2.0
177 stars 88 forks source link

Unable to close the popup on close button #53

Open RitaPatil08 opened 3 years ago

RitaPatil08 commented 3 years ago

when we add a cancel button no code is working to close the popup. please provide any solution on this.

ilyabodo commented 3 years ago

Assuming you were trying to do something like, Response.Write("<script language='javascript'>window.close();</script>"); don't use window.close(); and instead use parent.document.getElementsByTagName('dialog')[0].close(); as stated at the bottom of the README

krm0503 commented 7 months ago

parent.document.getElementsByTagName('dialog')[0].close(); does not work for me.... I get: Cannot read properties of undefined (reading 'close')