0

I tried several things, but everytime Chrome (and others?) detect a pop up... is possible to bypass it ?

            window.open(
            '/test.php',
            '_blank'
            );
            }, 2000);
Baraque Obahamas
  • 73
  • 1
  • 2
  • 17
  • As the author of the site, no, it's not supposed to be possible. Typically, new tabs/windows can only be opened while handling certain user events, such as button/link clicks. The user can choose to allow the popup or disable popup blocking, but you have no control over whether they choose either. – Jonathan Lonowski Aug 10 '15 at 03:43

2 Answers2

0

Can you please try the code below?

//1000 = 1 second
setTimeout(function () {
    window.open('url here', '_blank);
}, 1000);
Allan Chua
  • 9,305
  • 9
  • 41
  • 61
0

You would have to open the window using javascript, then set a setTimeout for two seconds that would wait for a variable to be set.

The new window would have to set a variable in the parent window to, lets say true.

Then with the setTimeout runs, it checks whether the variable is true, and if not, then opens the link. If it is, then do nothing

var didItOpen = false;
window.open('page.html');
setTimeout(function () { if (!didItOpen) location.href = 'page.html'; }, 2000);
Carl K
  • 974
  • 7
  • 18