0

I want to make user logout when user closes the browser tab/window

I have tried this code, but this is hitting even when we refresh the browser

    window.onbeforeunload = function() {
     return "Are you sure to close without logout";
     };

Is there any method to call the event only when user closes the browser tab/window other than refreshing the browser??

Thanks in Advance

Allu Manikyam
  • 481
  • 1
  • 8
  • 31
  • 1
    Possible duplicate of [Check if page gets reloaded or refreshed in Javascript](https://stackoverflow.com/questions/5004978/check-if-page-gets-reloaded-or-refreshed-in-javascript) – Jorge Fuentes González May 03 '19 at 10:37
  • Possible duplicate of https://stackoverflow.com/questions/11453741/javascript-beforeunload-detect-refresh-versus-close – Pavan May 03 '19 at 13:04

0 Answers0