0
With the event beforeunload, i can display a message when the page is to be canceled or updated.
 $(window).on('beforeunload', function () {
     return 'Testando';
 });
But the client for whom I usually develop systems do not like many of the layouts of the alert, confirm or prompt javascript.
So I’d like to, at this event of beforeunload, put a modal displaying a message in place of that alert appearing.
Is there any way to do this ? Is there any way to use the event beforeunload, without posting the message of alert?
There’s no way I can explain why Run script js when trying to close the window
– Guilherme Nascimento
It is not possible, here is a brief explanation jQuery beforeunload custom pop up window for Leaving a page
– Gabriel Gonçalves