How to detect page is not in use for more 10 min?

落花浮王杯 提交于 2019-12-13 20:55:28

问题


I want to set session as unlimitted by refreshing page every 10mins.

So i have to know page is using or not using right now ?

My refreshing code is working fine:

 string _CurUrl = Request.RawUrl.ToString();
 Response.AppendHeader("Refresh", "600; URL=" + _CurUrl  + "");

回答1:


There are various jQuery plugins for detecting if a user is idle.

jQuery idleTimer plugin - Paul Irish (Code on GitHub)

jQuery Idle Timeout Plugin - Eric Hynds (Code on GitHub)

Auto Timeout Plugin - Philip Almieri (Code on GitHub)

Google Search Results for more solutions.

I would use one of these rather than try to code something yourself which already exists. You will however have to customise the event which occurs when the TimeOut is detected to refresh the page.




回答2:


You should track keyPress and mouseMove events as nunespascal suggested-

Here is the link. This might help you

http://forums.asp.net/t/1312010.aspx



来源:https://stackoverflow.com/questions/15519100/how-to-detect-page-is-not-in-use-for-more-10-min

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!