window.onbeforeunload not firing
<p>I have created a fairly ajax-heavy web app and i am using the <code>window.onbeforeunload</code> event to detect if there are unsaved changes by the user and prevent her from navigating away from the page. The code is loaded by my init function and it used to work on all browsers that support the event. However, suddenly the onbeforeunload event stopped firing on every browser for no apparent reason. i am using jquery 1.7.1 and there are a lot of events attached to various elements (either via delegation or directly). Does anyone have a clue what might be the problem here? Here is a code snip:</p>

<pre><code>$(document).ready( function() {
  window.onbeforeunload = function(e) {
    if($(window).data("confirm") &gt; 0)
        return "You have unsaved changes";
    else
        return null;
  };
});
</code></pre>

<p>p.s. Even if i completely remove the check from within the callback and always return a string, which should prompt a message every time, it still does not fire. I have checked that my browsers are working correctly with the event with simple pages that bind a callback to it.</p>
