I am trying to display a confirm dialog when a user tries to close a window by click the ‘X’ in the top right corner. If the user goes for ‘OK’ option, I would like to continue closing the window but if the user presses the ‘Cancel’ button I would like to prevent the window from closing. Is there a way to do that?
Share
For Razor:
Tested and working. Note that this function is called when they click on the X or if you call
$("#Window").data("tWindow").close();so unless you have some validation check like I demonstrated you won’t be able to close the window. I don’t see a way to distinguish between clicking on the X and calling$(window).close()manually.