I need to know when the user clicks on the button that triggers window.open
if there is stable API/way to know beforehand if the user actively has
window.open() will mostly only be blocked if it was not triggered by a click event.
To confirm the window has loaded:
var loaded = false;
function windowLoaded() {
alert("The popup loaded");
loaded = true
}
function pause(milliseconds) {
var dt = new Date();
while ((new Date()) - dt <= milliseconds) { /* Do nothing */ }
}
document.write("start...");
//open the window
var win = window.open("window.html");
// If window.open returned an object
if(win) {
win.onload = function() {
win.RunCallbackFunction = windowLoaded;
};
document.write("popup sent...");
pause(3000);
// Verify that out window loaded
if (loaded == false)
document.write("check you popup blocker!");
else
document.write("ok!");
}
else {
document.write("window.open() was blocked...");
}