_blank

liunx

Guest
XHTML Strict seems to dislike the target _blank tag. Any workarounds?<!--content-->http://alistapart.com/articles/popuplinks/<!--content-->Hi there nichalp,<br />
<br />
It can be done like this...<br />
<br />
singly<br />
<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"http://www.google.com/" onclick="this.target='_blank'">google</a><br />
<br />
en masse<br />
<br />
<script type="text/javascript"><br />
//<![CDATA[<br />
function setTarget(){<br />
var a = document.getElementsByTagName("a");<br />
for(var n = 0;n < a.length;n++){<br />
a[n].target = "_blank";<br />
}<br />
}<br />
//]]><br />
onload=function() {setTarget();}<br />
</script><br />
<br />
<br />
coothead<!--content-->target was deprecated for a reason. Don't use it.<!--content-->Hi there Sam,<br />
<br />
I read this somewhere....<br />
<br />
Under XHTML strict, the target attribute for a link (or anchor) element is not recognised and thus will not validate. <br />
It is, however, still a part of the XHTML DOM and can be set via script, either singly or en masse:<br />
<br />
<br />
I cannot vouch for it's correctness though :D<br />
<br />
coothead<!--content-->I know its outdated, but many a time I need users to open an external link in a new window. Thanks coothead. Another thing, does this link open to users who have javascript disabled?<!--content-->onclick="target='_blank';" is the valid way to do it, but I guess coothead already posted that.<!--content-->target="_blank" works too, and it works for people not using javascript. Just because it doesn't validate doesn't mean it's a sin to use it<!--content-->onclick="target='_blank';" validates and it works for those without js because hving that event handler will not make the link no open in the main windows. Having it open in a new windows is just a conveiniance thing for the user, it will not kill sit functioanlity. It can be a sin to not have valid code if the client expects it to be valid.<!--content-->This topic has been discussed many times you should have SEARCHED THE BOARDS<br />
<br />
<!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/search.php?s=">http://www.webdeveloper.com/forum/search.php?s=</a><!-- m --><!--content-->The forum search is not of a very good quality.<!--content-->you mean it's possible other people have had this SAME problem? what a concept!<!--content-->Originally posted by IncaWarrior <br />
you mean it's possible other people have had this SAME problem? what a concept! it rivals the innovation of standardised parts. Maybe we could have a large 'faq' section that would cover all of the common problems! Thinking like that will get me black listed as a commy though.<!--content-->Try something like this, as the keywords: "Building a website using XML" Check out the result Inca, you too would find it dissuading to use the search ever again.<!--content-->Originally posted by PeOfEo <br />
it rivals the innovation of standardised parts. Maybe we could have a large 'faq' section that would cover all of the common problems! Thinking like that will get me black listed as a commy though. <br />
well isn't that what <!-- m --><a class="postlink" href="http://webdevfaqs.com">http://webdevfaqs.com</a><!-- m --> was supose to be, it doesn't seem to be going anywhere though.<br />
<br />
hehe.<!--content-->Originally posted by nichalp <br />
Try something like this, as the keywords: "Building a website using XML" Check out the result Inca, you too would find it dissuading to use the search ever again. Use a few good terms, like.<br />
<br />
XML* Data storage xhtml<br />
They do not need to form coherent sentances. Terms like a will through and error because they are too short. You need it to be 4 characters lone * is a wild. If you search for the word a you will get bum results.<br />
<br />
I hope web dev faqs grows. A link needs to be posted somewhere on the forum. Maybe as an announcement or a sticky on top of each forum.<!--content-->Just a question, though, wouldn't the target attribute not validate, since XHTML isn't for frames? Methinks that it would validate in XHTML Frameset. I always thought that it's main purpose was for targeting specific frames...<!--content-->It should in frames. Ill look real quick. But I know in html 4.01 it will not validate except for in the transitional and frameset doc types. Ok, I am looking at a list it says it would be valid xhtml 1.0 transitional. Try it and see, it looks like it will work for transitional and frame set xhtml 1.0. Xhtml 1.1 is very similar to xhtml 1.0 strict so it will not work in 1.0 strict or 1.1.<!--content-->Unfortunately I think it's going to be valid XHTML 2 because of the XFrames, I can't see anyone using them due to lack of IE support. I think that they should create a new attribute for a new type of frames, such as xtarget.<br />
However it will give rise to people using target and then saying "well it's valid".<!--content-->Why are they still making new types of frames, of course the older browsers will not supprt it. We need stuff that will downgrade, like a scrolling div, when it is not supported. What are they thinking?<!--content-->Maybe they want to bring back the advantages of a menu that doesn't have to reload for every page, I think the biggest problem will definately be that the tag will just be ignored by most browsers though, that's a huge accessibility barrier.<br />
I can't see many people using XFrames, at least not for a very long time.<!--content-->If they made it so that older browsers could accept it, it would be great. Some company needs to come up with a server side product that will adapt source code for text based browsers. Have it so like the known browsers that supprt the iframe will get it and other user agents will get an include. It could have a software update for each new browser release or something. You could hard code it that way with a server side lang, but someone needs to make it something that can be inalled on the server. That would be a nice innovation.<!--content-->But I have to question, what's the point of XFrames? What makes them so much more special, better, or more accessible than ordinary Frames? Why do we need them at all?<!--content-->Originally posted by MstrBob <br />
But I have to question, what's the point of XFrames? What makes them so much more special, better, or more accessible than ordinary Frames? Why do we need them at all? No its what akes them crappy is that they will be less accessible :p<!--content-->
 
Top