title: onbeforeunload event is too enthusiastic in IE9
body: <p>Here's some sample test html:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;body&gt;
      &lt;a href="javascript:alert('Not going anywhere!');"&gt;Go nowhere 1&lt;/a&gt;
      &lt;a href="javascript:void(0);" onclick="alert('Not going anywhere!');"&gt;Go nowhere 2&lt;/a&gt;
      &lt;a href="http://www.google.com"&gt;Go somewhere&lt;/a&gt;
      &lt;script type="text/javascript"&gt;
        window.onbeforeunload = function() { return "Really leave?"; };
      &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is available as a working page here: <a href="http://timjeanes.com/ie9_onbeforeunload.htm" rel="noreferrer">timjeanes.com/ie9_onbeforeunload.htm</a></p>
  
  <p>In Firefox, Chrome and Safari, I get the behaviour I want. That is, clicking either of the first two links shows an alert dialog; clicking the third link (or otherwise navigating away) shows the "Are you sure you want to leave this page?" message.</p>
  
  <p>However, in IE9, the "Are you sure you want to leave this page?" message also shows when you click either of the first two links, even though no navigation is taking place - we're just running some javascript.</p>
  
  <p>Is there something I'm doing wrong? Or is there a nice workaround for IE?</p>
  
  <p>One option would be to use href="#" and put my javascript in the onclick. I'm not keen on that as it takes the user to the top of the page, and my real-life page is quite tall.</p>
  
  <p>I've not tested in other versions of IE.</p>