浏览器关闭事件-适用于Chrome,IE,Firefox [英] Browser Close Event- fore Chrome,IE,Firefox

查看:145
本文介绍了浏览器关闭事件-适用于Chrome,IE,Firefox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨....哥们

我想将用户的结束时间存储在数据库中,因此需要用户的注销时间.当用户单击注销"按钮时,以及当用户关闭浏览器时.


谢谢
Shingala Anil

Hi....Budys

I want store User End time in database so need logout time of user When User Click On Logout Button And When User Close The Browser.


Thanks
Shingala Anil

推荐答案

用户注销后,将触发Global.asax方法中的Session_End方法.您可以使用此方法执行查询,以节省用户的注销时间.

如果用户未单击注销按钮并关闭浏览器,则在预定义的时间间隔(默认值为20分钟)之后再次执行Session_End方法.因此,您可以说注销时间的错误值为+20分钟.

也可以使用javascript
When the user signs out, the Session_End method in the Global.asax method gets fired. You can execute a query in this method to save the log out time of the user.

If the user does not click the log out button and closes the browser, then again the Session_End method gets executed after the predefined time interval (default is 20 mins). So you can say that the logout time can have an error value of +20 mins.

There is a way to capture the close (x) click event in browser too using javascript


这篇关于浏览器关闭事件-适用于Chrome,IE,Firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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