work around popup blockers

L

Leo Muller

Hi,

I found a nice way of working around popup blockers. A popup would be opened
automatically, but if it isn't then something else on the page would happen,
like displaying a manual link.

function StartGame(){
var newwin = window.open (http://www.com,"GameWindow","")
if(eval(newwin.opener==this)==true)
{
//if the popup did open do this.
}
else
{
//if the window did not open, do this.
}
}

Since we are all internet developers here, I hope that this may be of use to
anyone. Also comments / improvements are always welcome.

Leo Muller
 
H

Hans Kesting

Leo said:
Hi,

I found a nice way of working around popup blockers. A popup would be
opened automatically, but if it isn't then something else on the page
would happen, like displaying a manual link.

function StartGame(){
var newwin = window.open (http://www.com,"GameWindow","")
if(eval(newwin.opener==this)==true)
{
//if the popup did open do this.
}
else
{
//if the window did not open, do this.
}
}

Since we are all internet developers here, I hope that this may be of
use to anyone. Also comments / improvements are always welcome.

Leo Muller

some comments:
- If window.open didn't work, then probably newwin is null, so you can't
immediatly check newwin.opener. ("null or not an object")
- why "eval"?
- you don't need to check for "==true"

so your test could be:
if (newwin != null && newwin.opener == this)
(etc)

Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top