I have used window.onbeforeunload() to display an alert when the user navigates away from the page and this works fine,
jQuery(window).bind('beforeunload', function (e) {
var message = "Attention:";
e.returnValue = message;
return message;
});
In one of the views in my project I have used a timer.The problem is that,when the timer is timed out an alert is displayed and it is followed by the window.onbeforeunload() alert.
I want only the timer alert and not both to be displayed on timer timeout.
How can I achieve this?