botframeworkbotsdirect-line-botframework

How to detect if the user left web-chat preliminary?


Basically, this is a question: How to detect if the user left web-chat preliminary? Let's say the user closes a web page of the browser. Is there any way to catch this very moment?

Ideally, I'd like to catch an event and react to that - if such exist, but if there are any possible solutions to solve this problem - please reply.

More details - I'm using direct-line and web-chat only - there are no other channels.


Solution

  • You can attach an event listener to the beforeunload event to trigger whatever code you want before the window closes.