2

I'm not sure where on which Stack Exchange site to ask this question. I think this Stack Overflow is the wrong site, but I'm not sure where it should go. I see some specific answers that are related to more specific questions about various implementations of ajax calls or keepalive type behavior, but no discussion on alternate methods.

The Question

What methods exist to detect when a user has closed the browser? The only reliable method I know of is to ping the server with frequent ajax calls from the browser. The objective is to gain insight into whether the user is active in the browser to within about a minute.

Some details that may be useful (or maybe not):

  • We keep session data in a mongo database.
  • We have APIs we could send pings to.
  • We have background workers.

Some Possible Ideas For Other Answers

I don't have enough information to create better suggestions than these.

  • Maybe there could be a database trigger.
  • Maybe there could be a background worker that looks at session data.

(Edited to ask speficially which Stack Exchange site I should post to.)

  • This might be a reasonable question for Stack Overflow, but it's off topic here as this is a site about the workings of Stack Overflow – user226287 Feb 14 '14 at 22:14
  • Did you read this? meta.stackoverflow.com/help/whats-meta – user1228 Feb 14 '14 at 22:24
  • 2
    I'm not sure where to ask this question. - Meta seems to be the right place for this. – Pekka supports GoFundMonica Feb 14 '14 at 22:25
  • Thanks for commenting. I specifically am trying to figure out where to as a "discovery" question. I'm trying to probe for solutions that I might not have enough information about to even start investigating. – Kevin Dickerson Feb 14 '14 at 22:54
7

Stack Overflow is the appropriate site for this question. However, as currently written, it's possible that your question will be closed as too broad or a duplicate of an existing question.

If you do ask your question on SO, I recommend including information about your web application's platform and technologies, as these dictate what methods are available.

Please also search a bit before posting, as it's quite likely that you'll find some potential answers. For example, these are all highly relevant:

javascript detect browser close tab/close browser

How to detect if browser is closed using jQuery

Javascript detect browser close

https://stackoverflow.com/search?q=browser+close+detect+is%3Aquestion

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .