I want to show a customized popup with Yes/No buttons instead of default browser window in onbeforeunload . And need the window to stay open on click of 'No' button. But on click of both 'Yes'/'No' , my child window is getting closed. In case i write below code for cancel button, it again shows default browser window which shows two options 'Leave this page' and 'Stay on this page'.
I don't want to show default browser window with these options.
window.onbeforeunload = function askForExit(){
if(document.all && (document.readyState == 'complete' || document.readyState == 'loading')){
if(!confirm("Are you sure"))
{
return false;}}