Send form without the browser alert

Asked

Viewed 34 times

0

I’m submitting a form with JS and after everything goes well, I redirect the page as follows:

window.location.href = '/admin/lojas/produtos';

The problem is that always appears the alert below and the user has to keep clicking on "exit page" to complete the redirect.

inserir a descrição da imagem aqui

I know it’s normal to get this alert when you do the Submit of the form by POST, but there would be some way to change the way I’m doing the redirect to circumvent that warning?

  • Dude, is there any way to show the code? Like, usually this alert is activated when something is being processed yet(if I’m not mistaken).

  • You shouldn’t give this warning unless you’re directing to the same page. In this case, the browser may understand that the user may lose the data while directing...

1 answer

0

In case someone goes through the same problem, I was able to solve by inserting before the redirect the following code:

window.onbeforeunload = null;

Browser other questions tagged

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