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?
+8
A:
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'
mattl
2009-08-07 17:17:15
This seems a very clean solution to the problem. Thanks a lot!
Patrizio Rullo
2009-08-08 08:16:24
A:
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".
andrewWinn
2009-08-07 17:18:17
+2
A:
This is probably implemented with a idle timeout as discussed here on SO and on other websites.
Jweede
2009-08-07 17:19:09