How to display in new window not to use target="_blank" link

Target="_blank" is usually used to click the link by the web page, and to display a new window. This method of using JavaScript instead and using rel="external" was tested.

Problem whether to display link in new window

It is displayed that the description with rel="external nofollow" automatically starts the link of the comments in the word press, and this link is clicked in the same window. The link is clicked while pushing right-clicking in the link, the choice from the menu to display this in a new window or SHIFT or the CTRL key.

"_ blank target =" is usually used to click the link by the web page, and to display a new window. However, this writing doesn't conform to XHTML (1.0Strict and 1.1). This comes from the idea of not deciding the problem that the user should decide whether to open a new window on web page side.

However, it is a doubt whether to know the way that all users open in a new window. I want to open an external link still in a new window. Returning to former page again is serious otherwise, you do not know though will you already return.

Warning might go out when wrong as the inspection with the grammar checker of HTML when "_ blank target =" is used. There is a method of using JavaScript in the evasion of this.

Method of using JavaScript and using rel="external" instead of taget="_blank"

It is a method of reading JavaScript with the header of HTML, and using rel="external" or rel="external nofollow" instead of taget="_blank" when the link is set up.

function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i
var anchor = anchors[i];
if (anchor.getAttribute("href") &&
((anchor.getAttribute("rel") == "external nofollow") || (anchor.getAttribute("rel") == "nofollow external") || (anchor.getAttribute("rel") == "external"))) = "_blank";
window.onload = externalLinks;

This code is preserved in the domain route etc. for instance by the name of external.js, and it up-loads it. To call this, it describes it in the HTML header as follows.

<script type="text/javascript" src=""></script>

It is only written, rel="external" or rel="external nofollow" in a tag to use this when the link is made.

However, it is not possible to apply to the code in the advertisement though this can be applied in the code that I wrote. It is because it is prohibited to rewrite the code in Google and the optimism affiliate. This method doesn't pass satisfactorily either. It knows and there might not be disadvantage.