Advertisement
SEO

In these cases, don’t use the Target=” Blank” link attribute

Learn about the _blank link attribute and how to use it correctly to reduce site security and performance risks.

When you use the _blank link attribute, the link will open in a new browser window or tab.

However, it is not as simple as it appears.

It turns out that not only is the _blank link attribute a security risk, but there are several situations in which using something other than _blank is advised.

This article will teach you that using the _blank attribute is a bad idea.

The _blank link attribute instructs the browser to open a link in a new tab.

You can have multiple links that use the _blank link attribute, and each different link with that _blank attribute will open a new browser tab when clicked.

Furthermore, if a user repeatedly clicks the same link, the browser will keep spawning more and more tabs.

Is the _Blank Attribute Immoral?

Some argue that it is preferable to give the user the option of opening a new browser tab.

Some argue that “trapping” a user on your site by opening links in a new browser window while keeping your own web page open is unethical.

The problem with that viewpoint is that most people are probably unaware that they have the option to open a new browser window.

Every site’s audience is technically proficient at varying levels.

However, it’s likely that many people are still unaware that they can right-click (or long-click on a mobile device) and choose to open a new browser tab.

Giving users a “choice” isn’t really a choice.

They’ll go wherever you send them.

If a site visitor tries to return to the original web page by closing the browser tab they are currently in, the “ethical” choice of one person to open a link in the same web browser may confuse them.

Nowadays, the issue of ethics is largely ignored.

Whether or not to use the _blank link attribute is a personal and business decision.

There’s a security reason why you shouldn’t use _Blank

The target=” blank” link attribute is dangerous because it exposes a website to security and performance problems.

The risks of using the _blank link attribute are summarized on Google’s Web.dev page as follows:

“The other page may run on the same process as your page. If the other page is running a lot of JavaScript, your page’s performance may suffer.

The other page can access your window object with the window.opener property. This may allow the other page to redirect your page to a malicious URL.”

What is the solution?

For each link, use the rel=”noopener” or rel=”noreferrer” link attributes.

  • The rel=”noopener” link attribute prevents the linked site from gaining access to the original web page from which it is linking. This prevents the linked site from gaining control or influencing the linking site in any way.
  • The rel=”noreferrer” link attribute conceals the referrer information from the site to which the link is directed. When a site visitor clicks a rel=”noreferrer” link, the site being linked to is unaware of the site that referred the visitor.

The rel=”noreferrer” link attribute, like the “noopener” link attribute, prevents the linked site from taking control of the linking site.

So, if you want to send website referrer information while avoiding security issues with the _blank link attribute, use the “noopener” link attribute.

If you’d rather remain private and not share referrer information while also avoiding the security risks associated with the _blank link attribute, use the rel=”noreferrer” link attribute.

Considerations for Data Security on Sensitive Pages

A publisher may not want a user spawning multiple web pages in certain security-related situations. One example is a website that handles sensitive customer information.

If a health or finance-related website uses _blank for links to private information, the site visitor may be directed to multiple web pages containing sensitive information.

They may unintentionally leave these windows open.

For example, they may close the main window and another window while being unaware that a third window containing highly confidential information is still open in a browser’s background tab.

In that case, a site publisher may use a different link attribute, such as “blank” (with the underscore ).

The link attribute “blank” will open a link in a new browser tab.

Unlike the _blank link attribute, however, all other links on the original web page will open the linked page in the same tab as the first clicked link.

So, if you have five links on a page that use the “blank” link attribute, and a user clicks the first link, clicking any of the other four links will open the web pages in the same browser tab as the first clicked link.

As an alternative to _Blank Attribute

By the way, you don’t have to use _blank. You may substitute a different word.

The difference between _blank and any other word is that using another word will force every link on that page to open in a new browser tab.

For example, consider the following link:

<a href="https://www.example.com/" target="_SEJ" rel="noreferrer">

The link above will open in a new browser tab.

Now, suppose you have two links that both have the same link attribute:

<a href="https://www.example.com/" target="_SEJ" rel="noreferrer">

<a href="https://www.example.net/" target="_SEJ" rel="noreferrer">

If a site visitor clicks on the first link, a new browser tab will open.

If the site visitor clicks the second link, it will open the link in the same browser tab as the first link, effectively reusing that browser tab.

For Inline Frames, you might not want to use _Blank

A publisher may need to use something other than the _blank attribute on occasion.

Inline frames are one such example.

An inline frame is a type of HTML element that can contain another web document.

Some advertisements, for example, are contained within an iframe, resulting in a web page within a web page.

The iframe element is used to create an inline frame (also called an iframe tag).

Because an iframe is essentially a web page embedded within another web page, the HTML specifications include iframe-specific link attributes that will cause links embedded within an iframe to behave in a specific way.

It is still possible to use the _blank within an iframe to open a new browser tab and load a web page. However, if you want a specific behavior for an iframe, this is not recommended.

There are three iframe-specific link attributes available:

  • It will open a link outside of an iframe (as well as within the same web page).
  • _self: It will open the link within the same iframe (or web page) if the link is on the same domain. If the link is to another domain, it will not work.
  • _top: It will be displayed outside of an iframe (as well as within the same web page).

When it comes to the _blank link attribute, it’s probably safe to generalize and simply use it as long as it’s accompanied by a noreferrer or noopener link attribute.

Having said that, it’s good to know there are alternatives.

Finally, the use of the _blank link attribute can be as simple or as complex as you want it to be, depending on your specific needs.

Learn more from SEO and read How to use Surfer SEO.

Related Articles

Back to top button

Adblock Detected

Don't miss the best oppertunities.