0

We are using jQuery v1.11.3

The requirement is to display a Confirmation dialog with Yes and No button. The Confirmation dialog needs to be displayed before closing the browser and when user click on close icon.

Below code tried to use but not working .

<script type="text/javascript">
$(document).ready(function(){
    $(window).bind("beforeunload", function() { 
        return "Do you really want to close?"; 
    });
}); 


window.onbeforeunload = function(e){  
  return 'Calling some alert messages here'; 
}

</script>
James Z
  • 12,209
  • 10
  • 24
  • 44
Mihir
  • 572
  • 1
  • 6
  • 24

0 Answers0