0

In the below code I am using onbeforeunload event. This event fires when tab or browser is closed. This code is working fine in Firefox but this event also fires in IE9 but in another system have IE compatibility versions IE8,9 and 10. In that compatibility mode 8,9,10. This event is not firing at all.

<script language="JavaScript">
    window.onbeforeunload = WindowCloseHanlder;
    function WindowCloseHanlder()
    {
        window.alert('My Window is reloading');
    }
</script>

I had used onbeforeunload event which calls the function windowclosehandler. When I call this function I am just giving one alert to check whether that event fires or not.

chappjc
  • 30,359
  • 6
  • 75
  • 132
user2211918
  • 91
  • 3
  • 14
  • Duplicate : http://stackoverflow.com/questions/2032640/problem-with-window-close-and-chrome – rags Oct 11 '13 at 05:15

1 Answers1

0

Try this

<script type="text/JavaScript">
    window.onbeforeunload = WindowCloseHanlder;
    function WindowCloseHanlder()
    {
       alert('My Window is reloading');
    }
</script>
The Hungry Dictator
  • 3,444
  • 5
  • 37
  • 53
Amit
  • 15,217
  • 8
  • 46
  • 68