views:

178

answers:

2

Here is an example page: http://vincent-massaro.com/modal/modaltest.html

I am trying to have a window open with Jquery when a link is clicked, but delay the popup so that a message is first displayed before the popup happens. As you can see from the example the window.open happens not on the click, but on the fade, so this triggers a popup blocker because it is not being triggered by the user click input. Is it possible to move the window.open and delay it so that when the link is clicked, the window.open and the modal message fire off at the same time, but the window.open is delayed 5 seconds so that it doesn't trigger the popup blocker? Thanks!

+1  A: 
setTimeout(function() {

// window.open call

}), 5000 );

It won't be an accurate 5 seconds, it depends on how busy the browser is. But accurate enough. Put that in your .click fn.

meder
Can you modify my source? Javascript newbie here and I'm not sure exactly what you mean. Thanks.
I was able to get your code working, but it is still triggering the popup blocker in Firefox, Chrome, and Safari. Any other ideas?http://vincent-massaro.com/modal/modaltest.html#
This code should be ending like: "}, 5000 );" :)
Zuul
A: 

Haven't tried it, but put the window.open in a timeout function and bind it separately to the link.

jerone
Turned out this is not possible.