Links Won't Open In New Window in IE

D

dev/null

I'm experiencing a problem with IE7 and IE8. Links to external pages
won't open in a new window, but links to internal pages work fine.
For example

<a href="#" onClick="window.open('http://en.wikipedia.org/wiki/
SSL_Certificate','SSL
Certificate','scrollbars=yes,width=500,height=500');" >follow this
link</a>

works fine in Firefox 3.5, but it simply redirects back to the same
page in IE. However, trying to open a new window to a page that is on
the same directory level as the page which has the link works fine;
<a href="#" onClick="window.open
('test.php','test','scrollbars=yes,width=500,height=500');" >follow
this link</a> opens in a new window without a problem.

I have firebug 1.4 installed on Firefox, and I'm not getting any
errors when I click on the link. Any suggestions?
 
T

The Natural Philosopher

dev/null said:
I'm experiencing a problem with IE7 and IE8. Links to external pages
won't open in a new window, but links to internal pages work fine.
For example

<a href="#" onClick="window.open('http://en.wikipedia.org/wiki/
SSL_Certificate','SSL
Certificate','scrollbars=yes,width=500,height=500');" >follow this
link</a>

works fine in Firefox 3.5, but it simply redirects back to the same
page in IE. However, trying to open a new window to a page that is on
the same directory level as the page which has the link works fine;
<a href="#" onClick="window.open
('test.php','test','scrollbars=yes,width=500,height=500');" >follow
this link</a> opens in a new window without a problem.

I have firebug 1.4 installed on Firefox, and I'm not getting any
errors when I click on the link. Any suggestions?

Isn't this a new browser anti-popup security thing?
 
B

BootNic

I'm experiencing a problem with IE7 and IE8. Links to external
pages won't open in a new window, but links to internal pages
work fine. For example

<a href="#"
onClick="window.open('http://en.wikipedia.org/wiki/
SSL_Certificate','SSL
Certificate','scrollbars=yes,width=500,height=500');" >follow
this link</a>

The window name in the above example appears to have some sort of
white space, perhaps a space. “SSL Certificate†Remove or replace the
white space.

<a href="http://www.example.com/"
onclick="window.open(this.href,'popwin');return false;">example</a>

[snip]
<a href="#" onClick="window.open
('test.php','test','scrollbars=yes,width=500,height=500');" >follow
this link</a> opens in a new window without a problem.

This above window name does not have any white space.

[snip]



--
BootNic Wed Jul 1, 2009 06:06 pm
When I was younger, I could remember anything, whether it had
happened or not.
*Mark Twain*

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)

iEYEARECAAYFAkpL3dsACgkQmo2774GZ7qmIlgCeKwY6hkFLxbOvhXvLkcshV73R
2G4AoNO23vhGXVPf7jLtr5fBaM/N+xb7
=dkZP
-----END PGP SIGNATURE-----
 
T

Tim Down

I'm experiencing a problem with IE7 and IE8.  Links to external pages
won't open in a new window, but links to internal pages work fine.
For example

<a href="#" onClick="window.open('http://en.wikipedia.org/wiki/
SSL_Certificate','SSL
Certificate','scrollbars=yes,width=500,height=500');" >follow this
link</a>

works fine in Firefox 3.5, but it simply redirects back to the same
page in IE.  However, trying to open a new window to a page that is on
the same directory level as the page which has the link works fine;
<a href="#" onClick="window.open
('test.php','test','scrollbars=yes,width=500,height=500');" >follow
this link</a> opens in a  new window without a problem.

I have firebug 1.4 installed on Firefox, and I'm not getting any
errors when I click on the link.  Any suggestions?


Why are you trying to do this with JavaScript? Why not simply use the
target attribute of the <a> element?

<a href="test.php" target="_blank">test page</a>

Tim
 
T

Thomas 'PointedEars' Lahn

Tim said:
I'm experiencing a problem with IE7 and IE8. Links to external pages
won't open in a new window, but links to internal pages work fine.
For example

<a href="#" onClick="window.open('http://en.wikipedia.org/wiki/
SSL_Certificate','SSL
Certificate','scrollbars=yes,width=500,height=500');" >follow this
link</a>

works fine in Firefox 3.5, but it simply redirects back to the same
page in IE. [...] Any suggestions?

Why are you trying to do this with JavaScript? Why not simply use the
target attribute of the <a> element?

<a href="test.php" target="_blank">test page</a>

(target="_blank" is bad, use a unique window name instead.)

A plain link does not allow for trying to set the width and height of the
new window (if that); window.open() does. Both can be subject to popup
blockers.

However, the link above certainly is ill-advised (the whitespace in the
window name aside): nothing works without scripting; even worse, the UA
might as well scroll to the top of the document (`#' denotes a
same-document URI-reference) regardless of whether scripting works or not.
Much better (remove newline within the attribute value):

<a href="http://en.wikipedia.org/wiki/SSL_Certificate"
target="wikipedia"
title="More about SSL certificates at Wikipedia"
onclick="return !window.open(this.href, this.target,
'width=500,height=500,resizable,scrollbars');"
SSL Certificate</a>


PointedEars
 
T

Tim Down

(target="_blank" is bad, use a unique window name instead.)

Why is target="_blank" worse than a unique window name? Because it is
irritating for the user to always get a new window regardless of
whether one was already open? Are links using target="_blank" more
likely to be blocked by pop-up blockers than ones that use a normal
window name instead? My knowledge on this is not up to date.

Tim
 
T

Thomas 'PointedEars' Lahn

Tim said:
Why is target="_blank" worse than a unique window name? Because it is
irritating for the user to always get a new window regardless of
whether one was already open?

Exactly. In addition, new windows/tabs cost more memory that is not
always/immediately freed completely (especially on older Windozes).
Are links using target="_blank" more likely to be blocked by pop-up
blockers than ones that use a normal window name instead?

Probably, whereas "blocked" includes "re-routed" (for the lack of a better
term).
My knowledge on this is not up to date.

Sorry, I cannot provide test results or figures. There was much too little
incentive for that.

However, to avoid opening new windows (or tabs, but tabbed browsing wasn't
there yet) has also been recommended repeatedly by Jakob Nielsen, arguably
then and now the leading expert on usability. Cf.:

"The Top Ten Web Design Mistakes of 1999"
<http://www.useit.com/alertbox/990530.html>

"Top Ten Web Design Mistakes of 2005"
<http://www.useit.com/alertbox/designmistakes.html>

Incidentally, those and

"Top Ten Guidelines for Homepage Usability" (2002)
<http://www.useit.com/alertbox/20020512.html>

also cover what I implicitly recommended about the link caption.
Never ever use "follow this link" or "link" for that.


PointedEars
 
T

Tim Down

Sorry, I cannot provide test results or figures.  There was much too little
incentive for that.

However, to avoid opening new windows (or tabs, but tabbed browsing wasn't
there yet) has also been recommended repeatedly by Jakob Nielsen, arguably
then and now the leading expert on usability.  Cf.:

"The Top Ten Web Design Mistakes of 1999"
<http://www.useit.com/alertbox/990530.html>

"Top Ten Web Design Mistakes of 2005"
<http://www.useit.com/alertbox/designmistakes.html>

Incidentally, those and

"Top Ten Guidelines for Homepage Usability" (2002)
<http://www.useit.com/alertbox/20020512.html>

also cover what I implicitly recommended about the link caption.
Never ever use "follow this link" or "link" for that.

I'm aware that opening links in a new window has been frowned upon
with good reason for some time and have read those articles, just not
the specifics of why target="_blank" was worse. I recall also that
using a window name other than "_blank" had the disadvantage of not
focussing the target window in some browsers (can't remember which),
meaning that clicking a link would have no visible effect if the
target window was obscured.

Tim
 
D

David Mark

I'm aware that opening links in a new window has been frowned upon
with good reason for some time and have read those articles, just not
the specifics of why target="_blank" was worse. I recall also that
using a window name other than "_blank" had the disadvantage of not
focussing the target window in some browsers (can't remember which),
meaning that clicking a link would have no visible effect if the
target window was obscured.

That is the case for a named popup window that exists and has already
been obscured (clearly impossible for _blank.) Can be worked around
with scripting, but best to avoid popups entirely.
 
D

David Mark

Exactly.  In addition, new windows/tabs cost more memory that is not
always/immediately freed completely (especially on older Windozes).


Probably, whereas "blocked" includes "re-routed" (for the lack of a better
term).


Sorry, I cannot provide test results or figures.  There was much too little
incentive for that.

However, to avoid opening new windows (or tabs, but tabbed browsing wasn't
there yet) has also been recommended repeatedly by Jakob Nielsen, arguably
then and now the leading expert on usability.  Cf.:

"The Top Ten Web Design Mistakes of 1999"
<http://www.useit.com/alertbox/990530.html>

"Top Ten Web Design Mistakes of 2005"
<http://www.useit.com/alertbox/designmistakes.html>

I hope he's learned something about Web design since 2005. I haven't
looked at the actual content yet, but the markup is awful.

[snip]
 
T

Thomas 'PointedEars' Lahn

David said:
I hope he's learned something about Web design since 2005. I haven't
looked at the actual content yet, but the markup is awful.

Probably he has not written the markup as it is. AFAIK, he can be
considered an authority on usability, but not on HTML (or other markup
languages). I would consider that a good thing, though, because a
different perspective often helps to see what really is important.


PointedEars
 
D

David Mark

Probably he has not written the markup as it is.  AFAIK, he can be
considered an authority on usability, but not on HTML (or other markup
languages).  I would consider that a good thing, though, because a
different perspective often helps to see what really is important.

I didn't say his article wasn't a good thing. Largely, it was. There
was at least one mistake, but I'll assume he's figured it out since.
 

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,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top