Well, "target" attribute in anchor tag is not a valid attribute in strict doc type. Here is the best solution to open web pages in new window .
JS - jQuery
When you click on the link, it detects for rel attribute, if the value of rel attribute equal to "external" it will set the target to _blank, therefore, it opens in new tab/window :)
$('a[@rel$='external']').click(function(){ this.target = "_blank"; });
HTML/XHTML
This is how you use it.
<a href="http://www.queness.com" rel="external">Queness.com</a>
Comments will be moderated and
rel="nofollow"
will be added to all links. You can wrap your coding with[code][/code]
to make use of built-in syntax highlighter.Adding this class through jQuery has the benefit of the icon appearing only when javascript is enabled (and clicking will actually result in a new browser window)
$('a[rel=external]').click(function(){
$(this).attr('target', '_blank');
});
$(document).ready(function(){
$('#link_id').click(function(){
window.open('url', 'name', 'features', 'replace');
return false;
});
});
Source: http://sharp-coders.blogspot.com/2012/09/how-to-open-link-in-new-window-using.html