Run function when window closes

Discussion in 'JavaScript' started by Tintumol, Dec 14, 2010.

  1. #1
    Hey everyone. I'm developing a chat module for our cms. Its working mostly, but I need to make it so that in some situations when someone closes a window that it does a xmlhttprequest to mark the session as closed.

    Some lite reading seems tell me there is no onclose event, but there is an unload event. Further reading leads me to believe that the unload event may not work when a window is closed.

    Can anyone shed some light on this... how I can send a request to the server when a window is closed?

    Thanks!
     
    Tintumol, Dec 14, 2010 IP
  2. tvoodoo

    tvoodoo Active Member

    Messages:
    239
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    53