Launch and Open Links in New Window or Tab with _blank or _new as Target in HTML and Their Difference

»»»Launch and Open Links in New Window or Tab with _blank or _new as Target in HTML and Their Difference
On most websites, publishers may prefer to open the links to other web pages, especially external links that open web pages out of their own sites, in a new web browser window or tab, as most of the time, clicking on a link will load the new document from the link in the same window with where the link was. In HTML web programming language, to launch the new document (web pages) from links in a new window or tab effect is typically done through the use of target attributes on those links.

In this case, the link anchors will be using “_blank” as the value of the “target” attribute. “_blank” tells the web browser to open the new document loaded from the link in a new window. “target” attribute is also used in websites with frame structure to tell the web browser which frame the target page of a link should open when click. However, “_blank” does not require the use of any frames. The syntax or HTML code is typically as below:

<a href=”newwindow.html” target=”_blank”>New Window</A>

There are also publishers who use “_new” instead of “_blank” as the value for “target” attribute to open a link in new window. There is actually no “_new” defined as frame target names by W3C HTML standards. The only four reserved names are “_blank”, “_parent”, “_self” and “_top”. However, the “_new” value works the same way as “_blank” to launch the linked web documents in new browser window because of graceful error handling by web browsers. So “_new” is not a valid value for “target” attribute in link <a> anchor, and may cause inconsistent behavior for strictly HTML compliant browser that ignores all other target names as frame target name should begin with an alphabetic character (a-z and A-Z).

When “_new” is used, the web browser will look for an existing browser window that carries the “_new” handle name. If there is none then browser will create and launch the target web document at new window (or new tab in browser that supports tabbed browsing), where browser is considered to be recovering from HTML error of targeting a non-existent window. In this case, the new window will be named “_new”. However, if a window or a tab with “_new” handle already existed, the target page will be loaded into that window instead. Theoretically, you no need to use “_new” as the value for “target”, as any other value name (i.e. “newwindow” or “newtab”) will work to create a new window if the so named window hasn’t existed yet when clicked on the link.

In other word, if you want the links to open in a new window on every click, use the “_blank”. And you can use “_new” or another other valid value name starting with alphabetic character to open a new window and re-use that window for any other subsequent clicks that target to the same name.

Wanna tryout? Click on the following links:

Always Open in New Window or New Tab (target=_blank): _blank

Open in New Windows or New Tab Once then Always Load in This Window or Tab (target=_new or any name anchor you like): _new or any name for the target

By |2016-12-09T08:41:26+00:00December 9th, 2016|Categories: Web Publishing|Tags: |25 Comments

About the Author:

LK is a technology writer for Tech Journey with background of system and network administrator. He has be documenting his experiences in digital and technology world for over 15 years.Connect with LK through Tech Journey on Facebook, Twitter or Google+.