I tried the following code to get an alert upon closing a browser window:
<script language="JavaScript" type="text/javascript">
window.onbeforeunload = confirmExit;
function confirmExit()
{
return "Please log out before exit";
}
</script>
It works, but if the page contains few button, clicking on that any button raises the same alert. I need to show the alert only when I close the browser window and not upon clicking button.