title: Custom message when closing the browser/tab
body: <p>Can someone help me on how to customize the alert message when closing the browser/tab?
  I have tried all other codes in all forums, no luck. It displays the default alert message of the browser.</p>
  
  <pre><code>window.addEventListener("beforeunload", function (e) {
  var confirmationMessage = "Warning! Do not close, save first";
  
  (e || window.event).returnValue = confirmationMessage; //Gecko + IE
  sendkeylog(confirmationMessage);
  return confirmationMessage; //Webkit, Safari, Chrome etc.});
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/WV2Ni.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WV2Ni.png" alt="enter image description here"></a></p>