Search code examples
javascriptjquerypopupblocked

popup gets blocked , on second click its not blocked anymore


when i click on button1 a ajax requests gets sended, if success a hidden button should be shown an clicked via jquery click() method. The second button (button2) triggers an window.open event via jquery.

My problem is that on the first click the popup gets blocked on second click it isnt blocked anymore.I dont want that the popup is blocked.

I cant make it easier because i cant manipulate the second button.

Thanks for any help or solutions.

code:

<a href="javascript:;" class="button1">button1</a>
<div style="display:none;" class="buttonhidden">
    <a href="javascript:;" class="button2">button2</a>
</div>  

$('.button1').click(function(){
    url="someurl";
    $.ajax({
        url:url,
        async:    false,
        success:function(result){
            $('.buttonhidden').show(function(){
                $('.button2').focus().click();              
            });
        }
    }); 
});

Solution

  • i found a solution by switching btns on mouseenter but thanks for the help and idea's