title: Recommendations on how to prevent users from closing browser window (via onbeforeunload) AFTER the save button has been clicked?
body: <p>I've found numerous solutions on how to prompt the user about closing a window down before the data is saved but in my scenario, this one page is saving a lot of data and is slow (takes about 30 seconds) and this is AFTER the save button is clicked.  What we are finding is that the user is clicking the save button and then navigating or leaving AFTER clicking save.  Depending on the browser, whatever has been sent to the server isn't necessarily saved (looking at you Chrome).</p>
  
  <p>I opted to use this solution and almost does what I need except even when I click the save button, I'm still prompted to save the changes since I'm leaving the page.  Its like I need to turn off the prompt and then turn it back on after some delay.  Is this even possible?  </p>
  
  <pre><code>    window.onbeforeunload = function() {
          if ( Flag == 'Y' ) {
              return "Changes made. Don't want to save?";                         
          }
      }
  </code></pre>