Invoking a new browser window with a hyperlink

What is the HTML syntax for creating a hyperlink that will, when selected by the visitor to my website, will invoke a new browser window instead of driving the visitor from my website?

i using a simple text editor to create my web pages.

many thanks,

this is probably an easy one but as i am not sure, 100 points are offered....

;-)

chris
jcmeredithAsked:
Who is Participating?
 
nfroioConnect With a Mentor Commented:
errr, actually, _top does not do the right thing, now that i re-read your question, I think that the _blank extension will actually be the one that opens a completely new window.

<A HREF="targeturl.html" TARGET="_blank">Goto Page</A>

0
 
nfroioCommented:
<A HREF="targeturl.html" TARGET="_top">Goto Page</A>

that should do you, the tricks in the Targeting
0
 
lexxwernCommented:
yes, blank is the correct target.

this can be done with javascript too.

like this

<a href="#" onclink="javascript:window.open('hello.html','new window','height=  , width=  , scroll=yes/no, status=yes/no, address=yes/no')">link</a>
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
dorwardCommented:
Doing it with JavaScript is a rather nasty solution, if the user disables JS or uses a browser that doesn't support JS then it will not work (and some users are physically incapable of using browsers that support JS so this would be tantamount to discriminating against the disabled).

If you want to suggest a size for the window then you should provide a raw HTML backup, like so:

<a href="file.html" target="foo" onclick="if (window.open) { window.open(this.href,this.target,'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,width=200,height=100'); return false; } else { return true; };">link</a>  (replace "foo" with a name unique to your site, e.g. mySiteDotComTerms)

Although many users find popup windows irritating, I find its generally best to stick to the one window.
0
 
brunoCommented:
or

target="_new"


_top will just bust out of frames within the same window.
0
 
lexxwernCommented:
>> Doing it with JavaScript is a rather nasty solution,
i agree but you then have a more control

bruno,

target = "Anything Not Defined" will open in a new window, you know what i mean, try it out. but i dont really recommend this.
0
 
NeroausityCommented:
Hello there! What I have found that works just fine for me (of course, my site uses frames) is this:

target="null"

That way, when the link has that included, it will open a completely different pop up window, that the user can close without being directed away from your site.
0
 
dorwardCommented:
target="null" just creates a window called "null" in the same way that lexxwern explained.

_new though /really/ should be avoided. A myth has grown up that it creates a new unnamed window - it doesn't. If two sites both try to link to _new then they will interfere with each other.

Use _blank for a new window you don't plan to use, and something unique if you plan to reference it again from the site.
0
 
lexxwernCommented:
exactly,
the bottomline should now be _blank is for new windows and if you need more control use scripting.

anything from jcmeredith?
0
 
dij8Commented:
There are a multitude of other solutions but the most basic and strictly HTML solution is target="_blank".  http://www.w3.org/TR/html4/types.html#type-frame-target

nfroio wins the prize for this one (with an A of course).
0
 
brunoCommented:
dorward,

if another site tried to link to _blank after you've opened the window, it wouldn't open in the same window as well?


BRUNO
0
 
dij8Commented:
BRUNO, _blank is an HTML convention and will ALWAYS open a new window.  I guess it creates a unique ID so will never reference _blank as a named window.
0
 
dorwardCommented:
brunobear: Correct, as the specification says

The following target names are reserved and have special meanings.

_blank
The user agent should load the designated document in a new, unnamed window.

_self
The user agent should load the document in the same frame as the element that refers to this target.

_parent
The user agent should load the document into the immediate FRAMESET parent of the current frame. This value is equivalent to _self if the current frame has no parent.

_top
The user agent should load the document into the full, original window (thus canceling all other frames). This value is equivalent to _self if the current frame has no parent.

http://www.w3.org/TR/html4/types.html#h-6.16
0
 
mouattsCommented:
Actually using an undefined window name is sometimes a good idea in that if someone hits your link for the first time it opens up a new window, if they hit it a second time whilst the window still exists it will use that window again. Which means that the user doesn't end up with hundred of browser windows open!

Not heard of _new before, nice to know that someone out there is generating new Internet Myths :)
0
 
brunoCommented:
gotcha.  :-)
0
 
lexxwernCommented:
re: anything from jcmeredith
0
 
dorwardCommented:
mouatts: True, but due to the nasry urban myth of _new that makes it a very bad choice. Try something like mySiteDotComNEW
0
 
mouattsCommented:
dorward: I wasn't suggesting using it or maybe your sense of humour has just crashed.
0
 
brunoCommented:

Hello,

This question has been open for quite a while now and needs to be wrapped up.

EXPERTS: If any of the experts could come back and post any suggestions as to how they feel this could be wrapped up (delete, 0 PAQ, award points, etc), I'm sure the moderators would appreciate it.  If you feel you deserve points here, but don't care to respond, the question might very well get DELETED.

ASKER:  Please return and finalize this question.  Abandoning a question is in violation of the member agreement.

Please do NOT accept this comment as an answer, as I am simply trying to alert those involved that the question is still open.

Thank you,

BRUNO
0
 
dij8Commented:
nfroio wins the prize for this one (with an A of course).
0
 
nfroioCommented:
can't argue with sound reasoning and logic :-)

nfroio
0
 
mouattsCommented:
points to nfroio I suggest
0
 
COBOLdinosaurCommented:
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>
points to nfroio

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&
0
 
Computer101Commented:
Comment from expert accepted as answer

Computer101
E-E Moderator
0
 
jcmeredithAuthor Commented:
my apologies for abandoning this question. i lost my job abruptly and this project was taken over by someone else. i won't let it happen again.
0
 
nfroioCommented:
No worries on my end, sorry to hear about the job, hope that you have found employment elsewhere...

nfroio
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.