title: How to get an alert/confirm dialog box with custom message when refreshing a page
body: <p>I am trying to show a pop-up (alert/confirm box) with a custom message when a user refreshes a page. The reason is to alert the user that the data they entered might be lost. I have tried working with the 'beforeunload' event -&gt; <a href="https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload</a>.</p>
  <p>It shows a dialog box specific to the browser and the message cannot be modified anymore. Is there a way to show our prompt (alert/confirm) with custom message? If there is, will it cause any security issues?</p>