How to display a modal in the beforeunload?

Asked

Viewed 30 times

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?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.