Simplest XHTML 1.0 strict alternative to target=”_blank”
Sep 27th, 2011 by morpheus
The most common method of having a link open in a new window i.e., target="_blank" is invalid markup as per XHTML 1.0 strict.
If, like me, you are a stickler for valid strict markup, here’s the easiest solution to maintain markup validity when you must have your links open in a new window/tab.
Old markup –
<a
href="http://www.cybermilitia.net"
title="Cyber Militia"
target="_blank">
The most awesome site !
</a>
new XHTML 1.0 strict valid markup –
<a
href="http://www.cybermilitia.net"
title="Cyber Militia"
onclick="window.open(this.href, '_blank');return false;">
The most awesome site !
</a>
All done with a wee-bit of javascript.
One Comment on “Simplest XHTML 1.0 strict alternative to target=”_blank””
Leave a Reply
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Obrigado esse artigo foi util para mim…