title: How can I prevent window.onbeforeunload from being triggered by javascript: href links in IE?
body: <p>I'm building a fail safe for my form that is going to warn users that if they leave the page their form data will be lost (similar to what gmail does). </p>
  
  <pre><code>window.onbeforeunload = function () {    
          if (formIsDirty) {
              return "You have unsaved data on this form. Don't leave!";
          }
  }
  </code></pre>
  
  <p>The above function works great in firefox, but in IE it is triggered by any href link, even ones that are links to javascript and not other pages. </p>
  
  <p>for example....</p>
  
  <pre><code>&lt;a href='javascript:someFunction();'&gt;click&lt;/a&gt;
  </code></pre>
  
  <p>I'm wondering if there is any way to get around this, as I do not want the user thinking that they are leaving the page when they are simply clicking a button on it. <strong>I do not have the option of rewriting all the various links</strong> as they are built in and numerous.</p>
  
  <p>Any ideas?</p>