<!DOCTYPE html>
<html>
  <head>
    <!-- 
    This page differs from pageWithOnUnload.html in that it returns a string in the
    event handler, which causes a different type of alert to appear (the "Stay on
    page/Leave current page" alert).
    -->
    <script type="text/javascript">
      function onBeforeUnloadHandler() {
        return "This is for WebDriver with onbeforeunload event handler.";
      }
      window.onbeforeunload = onBeforeUnloadHandler;
    </script>
    <title>Page with OnBeforeUnload handler</title>
  </head>
  <body>
    <p>Page with onbeforeunload event handler. <a id="navigate" href="alerts.html">Click here to navigate to another page.</a></p>
  </body>
</html>