Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

alternative to target="_blank"

Tags:

html

What is the best alternative to target="_blank"?

Here is the doctype and html declaration we use:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
like image 912
tony noriega Avatar asked Dec 09 '10 16:12

tony noriega


1 Answers

It's just valid as per XHTML Transitional. You can keep using them. It's only invalid as per XHTML Strict.

Regardless, for the case that, you could workaround this with a little help of JavaScript. Replace all target="_blank" by rel="ext" (which is the defacto standard for external links) and run the following (jQuery) script on page load:

$(document).ready(function() {
    $('a[rel=ext]').attr('target', '_blank');
});
like image 169
BalusC Avatar answered Oct 23 '22 17:10

BalusC