title: onbeforeunload dialog cancellation with window.location.href IE8 bug
body: <p>Sorry about the obscure title, hopefully I can explain:</p>
  
  <p>I have a standard, "Are you sure you wish to leave" dialog that pops up when a user tries to leave a page:</p>
  
  <pre><code>window.onbeforeunload = function() {
      return 'You have unsaved changes';
  }
  </code></pre>
  
  <p>When this is coupled with <code>window.location.href</code> <strong>and the user clicking cancel</strong> an 'Unspecified error' is thrown in internet explorer 8 or earlier. The same doesn't seem to happen with other modern browsers.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $('input').click(function() {
          window.location.href = 'http://www.google.com'; // error is thrown here
      });
  &lt;/script&gt;
  
  &lt;input type="button" value="Go to google" /&gt;
  </code></pre>
  
  <p><strong>Is there any way I can continue to use window.location.href and get around this bug in IE8?</strong></p>