I need to redirect a page with javascript after submitting a form, the problem is that this form opens in a new tab and after opening this new tab I need to redirect the original tab to a new address.
Using the code below I can not do this:
$("#gerarBoletoForm").on('submit', function(){
window.location.replace('https://www.site.com.br/');
});
Not even if I use location.href or location.assign.
Is there any way to do this?