Posted By

neal_grosskopf on 02/25/08


html xhtml strict validation

Versions (?)

Who likes this?

5 people have marked this snippet as a favorite


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

 / Published in: HTML


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="" onclick=";return false;">Link</a>

Report this snippet  


RSS Icon Subscribe to comments
Posted By: wbowers on February 28, 2008

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

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: schkayalogy on May 17, 2009

Neat workaround using JavaScript so you don't have to type the 'onclick' event on every single anchor @

You need to login to post a comment.