title: How to destroy Vaadin 8 session on browser close or tab close?
body: <p>How to destroy session on browser close/tab close in Vaadin? We can use javascript to handle this. I tried below code: <code>Page.getCurrent().getJavaScript().execute("window.onbeforeunload = function (e) { var e = e || window.event; closeMyApplication(); return; };");</code>
  Problem with above script is, it will fire onbeforeunload event on page refresh also. Also, how to handle this situation in mobile devices(touch devices)?</p>