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).
window.
I just ran into a similar problem and found a very easy solution:
$("a").mousedown(function() { $(window).unbind(); });
This will remove the onbeforeunload event just before the click event is triggered.