I want to call Logout() function only when browser tab / browser close button is clicked not page refresh

I have a requirement in my app where i want to call Logout() function only when browser tab / browser close button is clicked.

Not when page navigation, page refresh.

I have used onbefeunload and onunload. but it is not working properly.

Thanks in Advance,

ConfD provides a JSON-RPC API. Figuring out browser events as triggers for when your code should call our JSON-RPC API is out-of-scope for what we can help you with. That’s JavaScript and Web programming stuff that doesn’t involve ConfD. If you have specific questions about JSON-RPC API, that’s what we can help with.