SHARE
Facebook X Pinterest WhatsApp

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

Written By
thumbnail
Michael Rohde
Michael Rohde
Jun 29, 2010

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=”https://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=”https://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.

Recommended for you...

Best VR Game Development Platforms
Enrique Corrales
Jul 21, 2022
Best Online Courses to Learn HTML
Ronnie Payne
Jul 7, 2022
Working with HTML Images
Octavia Anghel
Jun 30, 2022
Web 3.0 and the Future Of Web Development
Rob Gravelle
Jun 23, 2022
HTML Goodies Logo

The original home of HTML tutorials. HTMLGoodies is a website dedicated to publishing tutorials that cover every aspect of being a web developer. We cover programming and web development tutorials on languages and technologies such as HTML, JavaScript, and CSS. In addition, our articles cover web frameworks like Angular and React.JS, as well as popular Content Management Systems (CMS) that include WordPress, Drupal, and Joomla. Website development platforms like Shopify, Squarespace, and Wix are also featured. Topics related to solid web design and Internet Marketing also find a home on HTMLGoodies, as we discuss UX/UI Design, Search Engine Optimization (SEO), and web dev best practices.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.