I am trying to display a message to the user before closing the window. I use SweetAlert ( http://tristanedwards.me/sweetalert ), which works fine.
The problem is that JavaScript / jQuery will tell me when the user tries to close the window / tab, and then display something that prevents the page from closing if it doesn't click again.
<script language="JavaScript"> window.onbeforeunload = confirmExit; function confirmExit() { swal("Here a message!"); return "You have attempted to leave this page. Are you sure?"; } </script>
I tried this, but it displays an ugly regular message on top of my SweetAlert, any ideas? Without the return part, it still closes the window, I tried: /
source share