title: How to show Yes or No window in window.onbeforeunload?
body: <p>I am trying warn user to save data if he wants leave the page. The message should display simple "Do want save the data?" , If YES call code behind method (asp:button click), if NO leave the page from the page.</p>
  
  <p>But now It is showing Unwanted message string with my message (see below).</p>
  
  <p><img src="https://i.stack.imgur.com/uut4j.jpg" alt="enter image description here"> </p>
  
  <pre><code> var form_has_been_modified = 0;
      $(function () {
  
          $("input").keyup(function () {
              form_has_been_modified = 1;
          })
          window.onbeforeunload = function (e) {
              if (!form_has_been_modified) {
                  return;
              }
  
              var message = "Do you want to save the data before leave the page?";
  
              return message;
          }
  
      });
  </code></pre>