1

I am developing online chatting in my website. Some users close the browser when they are in online. I want to done some database operations when user closes the browser

I use this one

 window.onbeforeunload = function (event) {
            event = event || window.event;
            if ((event.clientX < 0) || (event.clientY < 0) || event.clientY < -80) { 
}

it does not work in non IE browsers..........

Can any one help me

4

1 回答 1

0

有关如何捕获浏览器关闭事件的信息,请参阅此问题。

现在您可以做的是在事件中执行 AJAX 调用来调用 Web 服务,这反过来会相应地更新您的数据库。

请参阅问题以防止在 AJAX 请求中间时关闭浏览器。

于 2012-04-23T08:52:43.903 回答