The TARGET="_BLANK" tag is as old as the hills when it comes to HTML, but some people seem to get very upset by it.

If you listen to some web evangelists, they will tell you to never use it, that the visitor should be able to be in control of whether pages open in the current window/tab or a new one (which, of course they can do using the right mouse button menu). In some ways they are right, but mostly they are just reacting to the obvious over-use of the tag by unscrupulous developers in the past.

I couldn't find any sensible guide on-line for best-practice for using the tag so I thought I would give you the benefit of my experience in web development and tell you when you should, and should not use it.

First of all, the negatives.

Beware devices that have limited space for tabs/windows. For example, on the iPhone and iPad, TARGET='_BLANK' will work but you have a limit of 9 web pages that can be open at any time. So if you already have 9 pages open, the link won't do anything.

Additionally, TARGET="_BLANK" won't validate under HTML 4.01 Strict, and won't even work at all in XHTML. XHTML is pretty much dead (hurrah!) but if you're the sort of person who orders your spice rack alphabetically and you really feel the need to use HTML strict and have it error-free, there is a JavaScript alternative to TARGET="_BLANK"

<A href="mypage.html" onclick="window.open(this.href,'_blank');return false;">Click me</a>

So here is my golden rule for when you should use TARGET="_BLANK"

Only use TARGET="_BLANK" when most people would be inconvenienced by the page they were previously viewing disappearing. In 99% of cases, TARGET="_BLANK" should only be used for external links.

May sites wrap every external link with TARGET="_BLANK" in order to keep the visitors on their site and not to lose them to a different site. Some people don't like this, but in many cases it can be a benefit. If you're reading a long article, and there's a link to an external page for more information about a specific point, or you want to click on a photo to see a larger version, it can be frustrating if you're kicked out of the page you were viewing. Modern browsers are pretty good at returning you to the point you were before when you click the back button, but even still, it's usually more sensible to open those sort of pages as a new tab/window.

Note that I said that most internal links should NOT open a new tab/window. Two specific exceptions for this are when you're opening up a page that is just to expand on a single point and then be closed (for example, clicking on an image thumbnail to open a larger version). At this point, you don't want the visitor to click the close button thinking they're going back to the page only to find they've closed and lost the tab they were reading. With these sorts of pages it's usually more natural to click a close button than the back button. And if you've opened in a new tab/window the back button won't be active anyway.

The other important time to use TARGET="_BLANK" is when you're in the middle of a form submission, or you're on a page that is a POST form result page - where either a link will lose data you are entering or the back button will not actually work (remember, use GET methods for most simple forms, eg site searches, to avoid this).

A good example is when you're in a shopping cart page, you're adding your details and delivery information and you want to check the terms and conditions of sale. The link to Terms and Conditions at this point should NOT mean you lose your progress in completing the form. This is a perfectly good example of when TARGET="_BLANK" works well.

Tel: 020 8680 1668 All Rights Reserved. Site Map. Copyright © 2000-2012 Mysterious Ways.