JSFiddle - React, Tailwind, and code Playground
JavaScript
var newWindow = open("http://fiddle.jshell.net/_display/", "test"),
looplimit = 3,
x=0;
function loopy() {
if (newWindow.innerHeight > 1) {
console.log(" opened2 ");
} else {
x++;
if ( x > looplimit) {
console.log(" blocked ");
} else {
setTimeout(loopy, 2000);
}
}
}
if (!newWindow) {
console.log(" blocked ");
} else if (newWindow && newWindow.innerHeight < 1) {
// Chrome blocked the popup lets check in a little bit if then open the window.
newWindow.onload = loopy;
} else {
console.log(" opened1 ");
}