With _target link targets are defined in HTML. Although target _blank in HTML provides the option of opening hy­per­links in a new window, this option is also viewed crit­ic­ally. The default setting _self, on the other hand, causes visitors to leave the current website.

Cheap domain names – buy yours now
  • Free website pro­tec­tion with SSL Wildcard included
  • Free private re­gis­tra­tion for greater privacy
  • Free Domain Connect for easy DNS setup

What is _target?

For dealing with hy­per­links on your website, the HTML attribute target is an important tool. Namely, with this attribute you create the target window of a link. If a visitor clicks on a link on your website, the new page will open in the current tab or window by default. If you don’t want this, you can use _target to specify that the link should open in a new tab or on a second page. This has the advantage that visitors stay on your online presence longer and do not leave it for another website.

However, there is also criticism of this practice. If visitors to your website have not made any other settings, you are in­ter­fer­ing with their user behaviour and opening a new page or tab without them re­quest­ing it. For this reason, this option was tem­por­ar­ily not allowed and returned only in HTML 5. It is now re­com­men­ded that you use the cor­res­pond­ing command in HTML called target _blank only when leaving your page would result in data loss. Thus, the command is for the benefit of users. You will learn how _target works later in this text.

Tip

You want to learn HTML? Our beginner tutorial will help you!

What is the syntax of _target in HTML?

The HTML attribute target is usually enclosed in the HTML tag and must contain a fixed value. Other allowed elements for _target are area, base and form. When written out, it looks like this, for example:

<a href="https://www.example.com" target="_parent">

What values are allowed for _target?

_target may contain the following values:

Value De­scrip­tion
_self _self is the default and requires the link to open in the same tab or page.
_blank _blank causes the hyperlink to open in a new tab or a different window.
_parent _parent causes the hyperlink to open in the parent window.
_top With _top the linked document will be opened in a whole window.
<name> With this option you can open the document in a defined iframe.

How is _target used in HTML?

_Target is placed inside an element. It looks like this in the code:

_self in code

_self is set as default. If you want to set the value manually, this is the code:

<a href="https://www.example.com" target="_self">Click here</a>.

target _blank in HTML

target _blank in HTML makes the link open in a new window or tab. If you use this value, you should add rel="noopener" for security reasons. Although this is not a must from a technical point of view, it is highly re­com­men­ded, as it prevents the linked page from po­ten­tially accessing usage data. In the code it looks like this:

<a href="https://www.example.com" target="_blank" rel="noopener">Click here</a>.

Now the cor­res­pond­ing link will open in a new tab.

Open links in a specified iframe

If you have precisely defined the name of a window in your frameset, you can also have the page open in it. If this option does not work because the name does not exist, a new tab will be opened auto­mat­ic­ally as in the HTML target _blank variant.

<a href="https://www.example.com" target="Defined window">Click here</a>.
Tip

A website made according to your wishes! IONOS provides everything you need to tailor your own website to your re­quire­ments with its Website Builder. You are free to decide whether you want to build the website yourself or whether you prefer to rely on our team of experts who will create the site in close co­ordin­a­tion with you.

Go to Main Menu