window.open does not work in mozilla

K

kaith

The following code used to popup a window when I used netscape 4.79.
Now I switched to mozilla 1.4 and the window doesn't popup.

function newWindow(newContent)
{
winContent =window.open(newContent,'nextWin','screenX=0,screenY=20,width=600....);
winContent.focus();
}

....
<a href="javascript:newWindow('foo.html')"
 
H

Hywel

kaith said:
The following code used to popup a window when I used netscape 4.79.
Now I switched to mozilla 1.4 and the window doesn't popup.

function newWindow(newContent)
{
winContent =window.open(newContent,'nextWin','screenX=0,screenY=20,width=600....);
winContent.focus();
}

Have you configured Mozilla to disallow pop-ups?
 
D

DU

kaith said:
The following code used to popup a window when I used netscape 4.79.
Now I switched to mozilla 1.4

Mozilla 1.7 will be out in a few days. Mozilla 1.4 is already 1 year old.

and the window doesn't popup.
function newWindow(newContent)
{
winContent =window.open(newContent,'nextWin','screenX=0,screenY=20,width=600....);

top and left are supported by NS 7.x, Mozilla 1.x, MSIE 5+, Opera 7.x
while screenX and screenY are only supported by NS 4+ and Mozilla.
winContent.focus();

This winContent.focus() call is unneeded and illogical. You should
instead verify/test if the popup exists and is not closed and if so,
then bring it back on top.
}

....
<a href="javascript:newWindow('foo.html')"

Make sure you have javascript support enabled.

If you code that way, by resorting to the "javascript:" pseudo-protocol,
Mozilla users won't be able to use Ctrl+click on the link to open in a
tab nor use Ctrl+Enter or Middle-click to open in a new tab. They won't
be able to open the link in other ways by choosing from their context
menu since the browser no longer sees the href value as a valid href
resource.
Finally, using "javascript:" pseudo-protocol is bad for a last reason:
nothing happens if javavscript support is disabled or non-existent:
about 5%-10% of people on the web surf without javascript support enabled.

http://jibbering.com/faq/#FAQ4_24

Top Ten Web-Design Mistakes of 2002
6. JavaScript in Links
http://www.useit.com/alertbox/20021223.html

"
Don't use javascript: URLs
Using a straight http: URL will allow any browser to access the link. If
you want to use JavaScript for browsers that have JavaScript enabled,
use the onMouseOver and onClick attributes of the <a href> tag.
"
http://www.panix.com/~aahz/javascript.html#remove

DU
 
T

Thomas 'PointedEars' Lahn

kaith said:
The following code used to popup a window when I used netscape 4.79.
Now I switched to mozilla 1.4 and the window doesn't popup.

function newWindow(newContent)
{
winContent =window.open(newContent,'nextWin','screenX=0,screenY=20,width=600....);
winContent.focus();
}

Unless you have disabled JavaScript popups in Mozilla 1.4, it would be
helpful if you posted all window features you have specified with the
third argument of window.open().
...
<a href="javascript:newWindow('foo.html')"

<http://jibbering.com/faq/#FAQ4_24>


PointedEars
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top