在浏览器关闭时更新用户注销状态 [英] update user logout status on browser close

查看:79
本文介绍了在浏览器关闭时更新用户注销状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将用户表中的字段STATUS从ONLINE更新为OFFLINE,以便当前的在线用户列表准确无误。

我使用的是visual studio 2010,aspnet 4.0版本

我有一个LOG OFF按钮可以执行此操作,但许多用户单击浏览器上的CLOSE(x)按钮关闭论坛而不是LOG OFF按钮,因此它们仍然在数据库和论坛上联机到其他用户。



是否有任何ASP代码在浏览器关闭时执行数据库更新uising右上角的(x)?



非常感谢。



Ashok Luhach



提前致谢

I want to update the field STATUS in the users table from ONLINE to OFFLINE so that the current online uer list is accurate.
I am using visual studio 2010, aspnet 4.0 version
I have a LOG OFF button that does this but many users click the CLOSE (x) button on the browser to close the forum instead of the LOG OFF button thus they are still ONLINE ain the database and on the forum to other users.

Is there any ASP code that performs a database update when the browser is closed uising the (x) at the top right ?

Much appreciated.

Ashok Luhach

Thanks in advance

推荐答案

Hello Ashok,



你可以使用类似下面所示的代码。
Hello Ashok,

You can use code similar to one shown below.


(document.ready(function(){
(document.ready(function() {


(window).bind('beforeunload',function (){
(window).bind('beforeunload', function() {


这篇关于在浏览器关闭时更新用户注销状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆