Displaying a confirm dialog box when the user tries to refresh/close/navigate to another web page
<p>I would like to warn the user with a confirm dialog box when he tries to refresh the page, navigate to another page, close the page.</p>

<p>Just like Gmail does; for example when you write something then try to close the page without sending your message, a warning dialog box will appear with two options:
Leave this page/Stay on this page</p>
