I've created this simple JavaScript function which I've added to an external Javascript file and now call from server-side code on most every page:
function ToggleBeforeUnload(onOff)
{
if (onOff == true)
window.onbeforeunload = UnloadPage;
else
{
window.onbeforeunload = null;
}
}
It *appears* that when onOff = false the latter statement is having no effect. In other words, by calling "window.onbeforeunload = null" what I want to do is NOT have it call "UnloadPage" anymore.
Is it possible that I'm using the wrong approach and there's another way to disable the "onbeforeunload" event?
Robert