title: How to use onbeforeunload in Dart
body: <p>In JavaScript it's possible to open a confirm dialog before closing the window.</p>
  
  <p>Example:</p>
  
  <pre><code>window.onbeforeunload = function(){
     return "Please don't go!";
  };
  </code></pre>
  
  <p>How can you achieve the same in Dart?</p>