I am trying to write a code such that when user close the browser or netvigate to other page, a message box will show up.
but then every time something in my web postback or reload, the same message box popup. I only want this to happen when user close the browser or netvigate to other page, not when the current webpage reload. How could I solve this problem?
Code:
<SCRIPT>
function closeIt()
{
event.returnValue = "Any unsaved data will be lost.";
}
</SCRIPT>
<BODY onbeforeunload="closeIt()">
Comment