I have a parent window and when I click a link from parent window, the link opens in a new window. I need to show confirm message on close of child window.(i.e. the opened link )
childWindow = window.open("http://www.google.com","width=400, height=400");
I like confirm close for child window. like
childWindow.close(function(){var confirmClose=confirm("Are you sure to close ?");
});
If the user clicks “OK” of the confirm box then the child window will be closed, else if the user click “Cancel” then the child window will not be closed
Use
onbeforeunloadevent: https://developer.mozilla.org/en/DOM/window.onbeforeunload