469,280 Members | 1,950 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,280 developers. It's quick & easy.

window.open does not work in mozilla

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,scree nY=20,width=600....);
winContent.focus();
}

....
<a href="javascript:newWindow('foo.html')"
Jul 23 '05 #1
3 1838
In article <c4**************************@posting.google.com >, kaith
says...
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,scree nY=20,width=600....);
winContent.focus();
}


Have you configured Mozilla to disallow pop-ups?

--
Hywel I do not eat quiche
http://kibo.org.uk/
http://kibo.org.uk/mfaq.php
Jul 23 '05 #2
DU
kaith wrote:
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,scree nY=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
Jul 23 '05 #3
kaith wrote:
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,scree nY=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
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jawahar Rajan | last post: by
2 posts views Thread by Rob | last post: by
9 posts views Thread by Justin Koivisto | last post: by
13 posts views Thread by Kai Grossjohann | last post: by
8 posts views Thread by Dominic Tocci | last post: by
14 posts views Thread by D. Alvarado | last post: by
29 posts views Thread by wayne | last post: by
13 posts views Thread by tochiromifune | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.