Open new window after a click event not working in Safari, Chrome

后端 未结 3 1522
广开言路
广开言路 2020-12-09 19:52

I\'m trying to open a new window like so:

$(\'#wrapper\').click(function() {
    window.setTimeout(function() {
        //alert(\'hi\');
        window.open(         


        
3条回答
  •  孤城傲影
    2020-12-09 20:22

    I got around this by checking the return value of window.open() for undefined. If that is true call alert() with a message for the user to to disable their popup blocker.

    var myWin = window.open([args]);
    
    if (myWin == undefined)
       alert('Please disable your popup blocker');
    

提交回复
热议问题