<html>
<head>
  <script>
      window.onbeforeunload = function(e) {
        return 'Unload?';
      };
  </script>
</head>
<body>
  <div>This triggers an alert on unload</div>

  <a href="/">Go away</a>
</body>
</html>
