PDA

View Full Version : Quick Easy Question



Conteo
Mar 30th, 2007, 12:55 PM
How do I make a hyperlink open in a new window instead of loading from the page where the link is?

jlhaslip
Mar 30th, 2007, 01:26 PM
target="_blank" but it is deprecated and not the recommended method. You should be looking at a javascript solution if validation is critical to you.

http://codingforums.com/search.php?searchid=976681

*wait*

Can't believe I just said that.

As the first topic on that search link discusses, it is not valid to have "target=" but the page validates if you use javascript to write the "target=" onto the document???
When it is run by a client, the net effect is code which is not valid. Only difference is the validator doesn't see it when you test the page... Get it?

Conteo
Mar 30th, 2007, 01:44 PM
no lol

nexosis
Mar 30th, 2007, 01:57 PM
<a href="" tagret="_blank"></a>
put it in your web page it will do it.

Conteo
Mar 30th, 2007, 02:28 PM
Okay, thanks. Where abouts in the code do I put it?

Arbitrator
Mar 30th, 2007, 02:31 PM
As the first topic on that search link discusses, it is not valid to have "target=" but the page validates if you use javascript to write the "target=" onto the document???
When it is run by a client, the net effect is code which is not valid. Only difference is the validator doesn't see it when you test the page... Get it?

no lol
I wrote that post (http://codingforums.com/showpost.php?p=540993&postcount=4) and, yes, the net effect of this technique (http://www.sitepoint.com/article/standards-compliant-world) is that you’ll still be using invalid code if you insert the target attribute via scripting under a (Strict) DTD that doesn’t allow said attribute. Use a Transitional DTD and nexosis’ method if you want to force a new window (although you should spell “target” correctly). The thread (http://codingforums.com/showthread.php?t=108930) also discusses the merits of opening a new window, if interested.


Okay, thanks. Where abouts in the code do I put it?nexosis just showed you where. It should be obvious if you know any HTML.