Created
June 28, 2013 17:17
-
-
Save pid/5886387 to your computer and use it in GitHub Desktop.
test popup blocker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment