title: How to trigger an exit popup?
body: <p>I'd like to make an exit popup on my website. I've prepared my modal but can't find "a good way" to detect a moment when a user is about to leave the website. I've read some other posts on this subject and found this piece of code:</p>
  
  <pre><code>$(document).ready(function() {
    $(document).mouseleave(function(e) {
      if(e.clientY &lt; 0) {
        $('#exit').modal('show')
      }
    });
  });
  </code></pre>
  
  <p>Unfortunately this solution doesn't work on IE and Edge. What's the better way of doing it?</p>
  
  <p><strong>UPDATE:</strong>
  Let me be more precise. I want to achieve something like <a href="http://blog.wishpond.com/post/93315626207/5-exit-popups-you-need-to-know-about" rel="nofollow noreferrer">this</a>. I assumed that the best way is to detect when a mouse leaves a document. </p>