Hi Guys, I tried following code to get an alert while closing browser window.
<script language="JavaScript" type="text/javascript">
window.onbeforeunload = confirmExit;
function confirmExit()
{
return "You have attempted to leave this page. If you have made any changes to the fields without clicking the Save button, your changes will be lost. Are you sure you want to exit this page?";
}
</script>
Its working but if the page contains one hyperlink,clicking on that same alert is coming.I need to show the alert only when i close the browser window and not on clicking hyperlinks.
Duplicate of Java Servlet : How to detect browser closing ? and some other. Just use the search facility... -- PhiLho