title: IE 11 beforeunload twice
body: <p>To prevent users leaving a form I make use of the event beforeunload:</p>
  
  <pre><code>$(window).on('beforeunload', exit_page);
  </code></pre>
  
  <p>For Firefox and Chrome this method is working fine but for Internet Explorer the beforeunload function is called twice.</p>
  
  <p>Therefore I implemented the trick of remembering that the event is called and set a timeout function. Like explained <a href="https://stackoverflow.com/questions/9967934/ie9-onbeforeunload-called-twice-when-window-location-changed-in-button-event">here</a>.</p>
  
  <p>For a couple of years this solution worked fine. But now I notice that this trick is not working for IE11. When the exit_page function is called for the second time and doesn't return a String, IE11 will not show a pop up message to prevent leaving the page but will just continue. Also for the cases returning (and set the (e || window.event).returnValue) null, false, will either do the same or show the pop up message for the second time (with false as message for example.) </p>
  
  <p>If the user wants to leave the page, the dialog only shows ones and then  the page redirects. </p>
  
  <p>I could not find a working solution for IE11 to prevent the beforeunload dialog for the second time. Is there a solution to fix this problem?</p>