Popup works in Mozilla, Firefox (Win & Lin) and Konqueror but not IE??

Armitage

Banned
Feb 23, 2001
8,086
0
0
That's it basically. I have some popups on a site I'm developing. Basically abbreviation keys, etc. They work fine on:

Mozilla/Linux
Firefox/Linux
Firefox/Windows
Konqueror/Linux

But not on Internet Explorer v6
There it open the popup page in the current page instead of a pop-up window.

Any ideas? I know zilch about javascript ... the code below is basically just a chop-n-drop out of a tutorial I found somewhere.

Here is the relevant chunk-o-code:
 

stndn

Golden Member
Mar 10, 2001
1,886
0
0
try this step:
open the page on mozilla.
click the link
on the mozilla address bar, type javascript:
it will pop up javascript console
check to see if there are any errors listed there...

you may also want to clear the error list before doing that, so you don't mix the javascript error generated by your page with the errors from elsewhere.

i kinda don't have time debugging the script for now. but if there are errors, that might help in finding what was wrong.
 

Cheetah8799

Diamond Member
Apr 12, 2001
4,508
0
76
My only guess is that the window.open() function in IE doesn't act like a popup window. Check around for some other pre-built functions and see if other people use the same window.open() function in theirs.

I've only done a little work with popups, and barely more than that with javascript, so I'm not much help... sorry...

also, make sure you aren't running a popup blocker in IE. ;)
 

KB

Diamond Member
Nov 8, 1999
5,406
389
126
IE is kind on malformed HTML but picky with its javascript:
Your code needs to be changed to:

<code>


<head>
<SCRIPT TYPE="text/javascript">
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string') {
href=mylink;
} else {
href=mylink.href;
}
window.open(href, windowname, 'width=400,height=200,scrollbars=yes');
return false;
}
//->
</SCRIPT>
</head>

...
<body>
Executed by something like this:
<A HREF='launch_key_pu.pl' onclick="return popup(this, '_blank')">(Key)</A>
</body>
</html>

</code>

Notice I had to add the curly braces to the if ... else statment and the window name needed to be changed to '_blank'
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
Try executing that JavaScript function like this:

<a href=&quot;javascript:popup('launch_key_pu.pl', 'Launch Key')&quot;>(Key)</a>
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
Thanks guys, I'll try it out as soon as my boss gets in. He's the only guy with a windows box that has access through the firewall at the moment.
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
Originally posted by: KB
IE is kind on malformed HTML but picky with its javascript:
Your code needs to be changed to:

<code>


<head>
<SCRIPT TYPE="text/javascript">
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string') {
href=mylink;
} else {
href=mylink.href;
}
window.open(href, windowname, 'width=400,height=200,scrollbars=yes');
return false;
}
//->
</SCRIPT>
</head>

...
<body>
Executed by something like this:
<A HREF='launch_key_pu.pl' onclick="return popup(this, '_blank')">(Key)</A>
</body>
</html>

</code>

Notice I had to add the curly braces to the if ... else statment and the window name needed to be changed to '_blank'

The Winner!
Turned out to be the '_blank' that did it. It works fine with or without the braces.
Thanks Greatly!! That's the kinda thing that would have taken me forever to find!

MrChad ... your suggestion doesn't bring up the popup for me on Mozilla or IE.
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
Originally posted by: Armitage
The Winner!
Turned out to be the '_blank' that did it. It works fine with or without the braces.
Thanks Greatly!! That's the kinda thing that would have taken me forever to find!

MrChad ... your suggestion doesn't bring up the popup for me on Mozilla or IE.

Just realized the capitalization in my code was messed up.

<a href=&quot;javascript:popup('launch_key_pu.pl', 'Launch Key')&quot;>(Key)</a>
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
Originally posted by: MrChad
Originally posted by: Armitage
The Winner!
Turned out to be the '_blank' that did it. It works fine with or without the braces.
Thanks Greatly!! That's the kinda thing that would have taken me forever to find!

MrChad ... your suggestion doesn't bring up the popup for me on Mozilla or IE.

Just realized the capitalization in my code was messed up.

<a href="javascript:popup('launch_key_pu.pl', 'Launch Key')">(Key)</a>

Oops, yea, I see it now also. I'll maybe give that a try in a bit.