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

0

I'm having trouble opening a new tab after a confirm and windows.open , follow 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 blocked, is there any way to open this tab without being blocked?

    
asked by anonymous 18.05.2015 / 15:33

1 answer

1

I made 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",
   });
});
    
01.12.2017 / 16:25