We Recommend

HTML: The Definitive Guide HTML: The Definitive Guide
They teach you that learning HTML is like learning any other language and that reading a book of rules can only take you so far. Readers begin writing what may be their first Web page just two pages into the book's second chapter. From there on, they provide a wide range of HTML coding to allow readers to learn from good examples. The book includes a handy "cheat sheet" of HTML codes for quick reference.


Posted By

neal_grosskopf on 02/25/08


Tagged

html xhtml strict validation


Versions (?)


Who likes this?

4 people have marked this snippet as a favorite

neal_grosskopf
SmpleJohn
brent-man
basicmagic


How To Use target="_blank" Correctly In XHTML & HTML Strict


Published in: HTML 


URL: http://www.nealgrosskopf.com/tech/thread.asp?pid=2

If you've ever used a strict doctype and used the target attribute on links you'll notice that it doesn't validate. Here is an easy solution.


  1. <a href="http://www.nealgrosskopf.com" onclick="window.open(this.href);return false;">Link</a>

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: neal_grosskopf on April 7, 2008

At some point, developers need the ability to do it at least. The W3C depreciated target="_blank" because they felt it was more of a behavior and would best be accomplished using javascript.

Posted By: wbowers on February 28, 2008

It doesn't validate for a reason - because opening links in new windows is bad for accessibility.

You need to login to post a comment.