How to open new tab without blocking pop-up after windows.open()?

Asked

Viewed 1,836 times

0

I’m having trouble opening new tab after a confirm and windows.open, follows the code:

    function dec(){
      var matricula =  "<?php echo $matricula;?>";  
      var receita =  "<?php echo $receita;?>";                           
    decisao = confirm("Matricula: "+matricula+"\nReceita: "+receita+"\nReceita cadastrada com sucesso!"+"\n\n"+"Deseja imprimi-la?");
    if (decisao)
window.open('imprimir_receitas.php?matricula='+matricula+'&receita='+receita, 'blank');
    }

After clicking ok the pop-up is locked, ah some way to open this tab without being locked?

  • Have you tried setting the height and width parameters? Which browser?

  • @Vanderson jpa tried yes with size, for example passing along the parameters the values 'width=200, height=100'. but nothing helped :/

  • In all browsers this?

  • @Vanderson yes, in the main firefox and Chrome happens it. IE works but is not fully compatible with my system.

  • These two examples are working. Testa ai: - http://jsbin.com/aboluk/2/edit?html,js,output - http://output.jsbin.com/aboluk/148/edit?html,js,output

  • Guys, I ended up solving this problem using modal.

Show 1 more comment

1 answer

1

I did it in a way using attr, due to the lock of the window.open see:

$(document).on('click', '#sus-div-que-abraca-o-item > div', function() {
    var campoRadio  = $(this).find("input[type='radio']").val();
    var quantidade = 1;
    $("#link-bto").attr({
        href: "../comprar.php?categoria="+categoria+"&quantidade="+quantidade,
        target: "_blank",
   });
});

Browser other questions tagged

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