Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Invoking a new browser window with a hyperlink

Posted on 2002-06-07
26
Medium Priority
?
297 Views
Last Modified: 2010-04-09
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
0
Comment
Question by:jcmeredith
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 4
  • +7
26 Comments
 
LVL 5

Expert Comment

by:nfroio
ID: 7063535
<A HREF="targeturl.html" TARGET="_top">Goto Page</A>

that should do you, the tricks in the Targeting
0
 
LVL 5

Accepted Solution

by:
nfroio earned 400 total points
ID: 7063542
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
 
LVL 12

Expert Comment

by:lexxwern
ID: 7063794
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 17

Expert Comment

by:dorward
ID: 7064242
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
 
LVL 18

Expert Comment

by:bruno
ID: 7064412
or

target="_new"


_top will just bust out of frames within the same window.
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7064518
>> 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
 

Expert Comment

by:Neroausity
ID: 7064696
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
 
LVL 17

Expert Comment

by:dorward
ID: 7064714
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
 
LVL 12

Expert Comment

by:lexxwern
ID: 7064952
exactly,
the bottomline should now be _blank is for new windows and if you need more control use scripting.

anything from jcmeredith?
0
 
LVL 10

Expert Comment

by:dij8
ID: 7065964
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
 
LVL 18

Expert Comment

by:bruno
ID: 7066021
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
 
LVL 10

Expert Comment

by:dij8
ID: 7066523
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
 
LVL 17

Expert Comment

by:dorward
ID: 7066528
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
 
LVL 11

Expert Comment

by:mouatts
ID: 7067477
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
 
LVL 18

Expert Comment

by:bruno
ID: 7067602
gotcha.  :-)
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7067669
re: anything from jcmeredith
0
 
LVL 17

Expert Comment

by:dorward
ID: 7067680
mouatts: True, but due to the nasry urban myth of _new that makes it a very bad choice. Try something like mySiteDotComNEW
0
 
LVL 11

Expert Comment

by:mouatts
ID: 7067874
dorward: I wasn't suggesting using it or maybe your sense of humour has just crashed.
0
 
LVL 18

Expert Comment

by:bruno
ID: 7146413

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
 
LVL 10

Expert Comment

by:dij8
ID: 7146735
nfroio wins the prize for this one (with an A of course).
0
 
LVL 5

Expert Comment

by:nfroio
ID: 7146892
can't argue with sound reasoning and logic :-)

nfroio
0
 
LVL 11

Expert Comment

by:mouatts
ID: 7147009
points to nfroio I suggest
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7182455
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
 
LVL 1

Expert Comment

by:Computer101
ID: 7182878
Comment from expert accepted as answer

Computer101
E-E Moderator
0
 

Author Comment

by:jcmeredith
ID: 8182377
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
 
LVL 5

Expert Comment

by:nfroio
ID: 8183408
No worries on my end, sorry to hear about the job, hope that you have found employment elsewhere...

nfroio
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question