Saturday, February 26, 2011

Hyperlink Open in new window or tab

In response to a blogger request, here is the HTML for a hyperlink that opens in new window and tag (that is, visitor will not lose your site):

<a href="target URL" target="_blank">anchor text</a>


<a href="target URL" target="new">anchor text</a>

1. target="....." has been deprecated and is not XHTML compliant and will give errors when you try to validate your website with

This is because the people drafting the new standard feels that this should not be forced upon visitors but left to visitors to make a link open in the same or new window or tab (you can make a hyperlink open new window or new tab by right-clicking on a link and choosing either). But how many surfers know how to do that?

target="...." is still effective in many current browsers. Don't know about the future.

2. anchor text is the text that will be displayed by the browser. For example this is the HTML to the father of this blog which will soon be converted to custom domain:

<a href="URL" target="new">Linux Kernel Programming</a>

for the above code the browser will display it as below, and usage of target="new" will open the link either in new window or tab, check this by clicking below link.

Linux Kernel Programming

Anchor text is important from the SEO (Search Engine Optimization) point of view.

3. Many webmaster feels that forcing visitors clicking on links in your site to open new windows or tabs is a wrong strategy and may discourage repeat visits, but this subject is controversial. Do your own research.


  1. online jobs Copy Paste Jobs, Online copy paste work, online jobs online works india best site for work from home.