admin管理员组文章数量:1287983
How Facebook detects your away state (you know, the half moon in the chat window)? How you can check in Javascript if a person is away from your page, even if it's open in the browser? Do you think there is any library that already does it?
How Facebook detects your away state (you know, the half moon in the chat window)? How you can check in Javascript if a person is away from your page, even if it's open in the browser? Do you think there is any library that already does it?
Share Improve this question asked Aug 7, 2009 at 17:15 Patrizio RulloPatrizio Rullo 4711 gold badge4 silver badges13 bronze badges4 Answers
Reset to default 9JQuery idleTimer plugin
They have JavaScript which runs every 30-60 seconds and reports back, plus they know if you're browsing to other pages on the site, which would reset the counter.
Note, if you open up Facebook, and then browse another site and never go back to the Facebook tab, you'll be 'away'
This is probably implemented with a idle timeout as discussed here on SO and on other websites.
I would guess that on each request they set a variable that is last activity time. Then they would query that value using AJAX and after a specific amount of time, you are considered "away".
本文标签: javascriptHow Facebook detects that you are awayStack Overflow
版权声明:本文标题:javascript - How Facebook detects that you are away? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741336284a2373059.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论