i have to call the javescript function on browser close event for that i have write the fallow code
<script type="text/javascript">
window.onbeforeunload = function (event) {
alert('U have to leave this page');
};
</script>
but the bproblem is that it get fired when
1) reload the page
2)redirect to another page
3)close browser
i want only thired once plz help to catch the browser close event in javascript