Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you check if a popup was allowed?

Status
Not open for further replies.

MrSki

Programmer
Dec 13, 2000
66
0
0
US
We are creating online courses that use popup windows for a lot of the items within it. One of the biggest complaints we get are people who can not "see the course" when they click to start it. In most cases, they have had a popup blocker that stopped a window from opening.

Is there a way for the calling window to verify if a popup has opened and, in the case where it does NOT open, display a message to the user to check or disable their popup blocker?



Mitch Duszynski
 
maybe (this is not tested)

win=window.open....
timer=setInterval("CheckOpen()",100)

function CheckOpen()
{
if(typeof(win)=="undefined")
{
alert("Do you have a popup blockcer?")
clearInterval(timer)
}
}

Note:win and timer must be global objects...

Known is handfull, Unknown is worldfull
 
What I would do:

Code:
function openWindow(url, name, settings) {
    var w = window.open(url, name, settings);
    if (!w)
        alert('The window was not opened');
}

Code:
<a href="page.html" onclick="openWindow(this.href,'win',''); return false;">Click Me Or Die</a>

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top