Javascript window.open issue in safari

Viewed 6412

I am tying to open new tab using jquery. But, it's not working in safari or Mac.

My code:

<script>
    $(document).ready(function(){
        $.ajax({
            type: 'post',
            dataType: 'html',
            url:'http://localhost/test/remoteContent.html',
            async: false,
            success:function(data){
                window.open("http:google.com",'_blank');
            }

        })
    });
</script>
2 Answers

I have found alternate solution for this. After ajax response create anchor tag element and trigger click event

 var a = document.createElement('a');
 a.href = 'https://google.com';
 a.setAttribute('target', '_blank');
 a.click();
Related