0

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;}}
  • 1
    Possible duplicate of [Javascript - rename confirm() buttons](https://stackoverflow.com/questions/22885897/javascript-rename-confirm-buttons) – nicael Mar 30 '18 at 09:35
  • Possible duplicate of [Is it possible to display a custom message in the beforeunload popup?](https://stackoverflow.com/questions/38879742/is-it-possible-to-display-a-custom-message-in-the-beforeunload-popup) – Rohan Fating Mar 30 '18 at 09:56

0 Answers0