title: Is it possible to display modalbox , Only if user click on close tab/browser button?
body: <p>I am trying to display a share box . my requirement is to display a bootstrap model box , if and only if user click on the close tab/browser button . if its possible how ? </p>
  
  <p><strong>HERE IS MY CODE which is not working  :</strong></p>
  
  <pre><code>var unhook=0;
   jQuery(window).bind('beforeunload', function(e) {
      if(!unhook){
      var message = "Why are you leaving?";
      $("#myModal4").modal();
      console.log(e);
      // e.returnValue = message;
      // return message;
   }
  });
  
  $(function () {
    $("a").click(function {
      var unhook=0;
    });
  });
  </code></pre>
  
  <p>NOTE: I don't want to show simple alertbox , I have to display a modelbox where user will put the review . that's why my question is different </p>