Web 101 Links: When and How to Open a Link in a New Window

By Michael Rohde

Web 101 Links: When and How to Open a Link in a New Window For many website owners out there, one of the top objectives is to get visitors to their pages and keep them there. However, a time might come when you want to link to another site, especially if that other site has some very useful and pertinent information that you feel your readers should know about. This tutorial will show you how to create a link that opens up a page in another tab or window, allowing your visitors to stay on your site!

You could create your link so that it goes directly from your site to the other site and then hope your visitor will click the Back button to return to your site. This is how a basic link is set up:

<a href="http://www.htmlgoodies.com/>HTMLgoodies</a>
and here is how it looks: HTMLgoodies

To increase the chances of your visitor coming back to your site after they visit the other site, you can add a snippet of code to the to keep the current window open. In today's browsers, using this bit of code simply opens a new tab, and your site remains open in the original tab. Here's how you do that:

<a href="http://www.htmlgoodies.com/" target=_blank>HTMLgoodies</a>
and here's how it looks (and more importantly, try it out so you can see what happens when you click the link): HTMLgoodies

All you have to do is add "target=_blank" right after the URL to which you are linking. This opens a brand new tab and a new window. To get back to your site, all your visitor has to do is click the tab with your site open.

Now, you might be thinking to yourself, "I can use that all the time!" If you use this code on every single one of your links that simply links to another page in your site, then the visitor will wind up having several of your site's pages open in several different tabs and windows.

While you might think that's a great way to allow an easy means for your visitors to go back to already visited pages, your visitors might view that as an extreme annoyance. If each of your links opens a new window that means your visitor will have to close each of those new windows. The annoyance factor on that alone could drive the visitor away from your site forever.

If you are concerned that your visitor is a web newbie and they aren't sure about the Back button, then by all means make sure that you have links on your page so that the visitor can easily find their way back to where they were. Once upon a time, many sites relied on breadcrumb trails so that a visitor could visually see, and click, back to where they were.

This practice died off due to many questions on the trails purpose and how they worked. The best practice is to ensure that you have clear and obvious links along either the top of the page or running along the left side of the page. That way, the visitor does not need the Back button, you don't need an unintentionally confusing breadcrumb path and you most certainly do not need to use "target=_blank" for each and every link.

Use "target=_blank" judiciously and only for links that take your visitor to other sites.

Make a Comment

Loading Comments...

  • Web Development Newsletter Signup

    Invalid email
    You have successfuly registered to our newsletter.
  •  
  •