How to get browser close event in asp.net

{0 Comments}

in most of cases when there is need to do something on closing of the browser windows. In asp.net we can get the desired work done on closing event of browser.  For this we can use JavaScript which detect the close event and do some thing after detection. 

 Javascript |  copy code |? 
1
<script type="text/javascript">
2
    window.onbeforeunload = function(e) {
3
    // check condition
4
    return ' your message .';
5
};
6
 
7
    </script>

Leave a Comment

Your email address will not be published.