Using the _blank link attribute will open the link in a new browser window or tab.
But it is not as direct as it seems.
It turns out that the _blank link attribute is not only a security risk, but there are also multiple situations when something other than _blank is used.
In this article, you will learn how using the _blank attribute is not a good idea.
What is _Blank Link?
The _blank link attribute tells the browser to open a link inside a brand new tab.
You can have multiple links using the _blank link attribute, and clicking each different link with the _blank attribute will lead to a completely new browser tab.
Moreover, if the user clicks on the same link over and over again, the browser will keep producing more and more tabs.
Is the _Blank attribute unethical?
There are those who feel that it is better to give the user the option to open a new browser tab.
Some people assert that it is unethical to “hunt” a user on your site by opening links in a new browser window and also keeping your web page open.
The problem with this view is that it’s very likely that most people don’t know they have an option to open a new browser window.
Each site audience is technically savvy at different levels.
But it’s probably safe to say that many people still don’t know that they can right-click (or right-click on a mobile device) and choose to open a new browser tab.
So giving users “choice” isn’t really an option.
They just go wherever you send them.
Someone’s “ethical” choice to open a link in the same web browser can confuse a site visitor if they attempt to return to the original web page by closing the browser tab they are currently in.
The question of ethics has been largely set aside for the time being.
Whether or not to use the empty link attribute is a personal and business choice.
There is a security reason not to use _Blank
The target=”_blank” link attribute is risky and opens a website to security and performance issues.
The Google Web.dev page about risks The use of the _blank link attribute is summarized as follows:
The other page can access your window object using the window.opener property. This could allow the other page to redirect your page to a malicious URL.”
Use the link attributes rel=”noopener” or rel=”noreferrer” for each link.
- the rel = “no opener” The link attribute prevents the linked site from receiving access to the original web page being linked to. This prevents the linked site from controlling or otherwise affecting the linked site.
- the rel = “noreferrer” The link attribute hides referrer information from the site it is linked to. When a site visitor clicks on a rel=”noreferrer” link, the linked site will not know which site referred the visitor.
The rel = “noreferrer” link attribute also works like the “noopener” link attribute in that it prevents the linked site from controlling the linking site.
Therefore, if you want to submit website referral information while protecting yourself from the security issues of the empty link attribute, use the “noopener” link attribute.
If you prefer to keep private and not pass referrer information while also protecting yourself from the security issues associated with using the _blank link attribute, use the rel = “noreferrer” link attribute.
Data security considerations for sensitive pages
There are specific security situations where a publisher may not want a user to create multiple web pages. One such case is a website that handles sensitive customer information.
If a health or finance website uses _blank for links to private information, it may cause the site visitor to post multiple webpages containing sensitive information.
They may inadvertently leave these windows open.
For example, they may close the main window and another window and not realize that there may be a third window still open with top-secret information in a background tab in their browser.
In this case, the publisher of the site may choose to use a different link attribute such as “blank” (with an underscore _).
The Blank link attribute will open a link in a brand new browser tab.
However, unlike the _blank link attribute, all other links on the original webpage will also open the linked page in the same tab that the first link was clicked on.
So, if you have five links on a page that use the “blank” link attribute, and the user clicks on the first link, then any of the other four links when clicked will open web pages in the same browser tab where the first link was clicked.
Alternate attribute _Blank
You don’t have to use _blank, by the way. You can use a different word.
The difference between using _blank and any other is that using another word will limit every link on that page to opening within the same new browser tab.
For example, if you encode a link like this:
<a href="https://www.example.com/" target="_SEJ" rel="noreferrer">
The above link will open in a completely new browser tab.
Now, if you have two links with 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, it will result in a new browser tab.
If a site visitor clicks on the second link, the link will open in the same browser tab as the first clicked link, essentially reusing the same browser tab.
You may not want to use _Blank for inline windows
There may be times when a publisher may need to use something other than the _blank attribute.
One such case is inline frames.
An inline frame is an HTML element that can contain another web document within it.
For example, some ads are embedded in an iframe so that they end up being a webpage within a webpage.
An inline frame is marked up using the iframe element (also called the iframe tag).
Since an iframe is a webpage embedded in another webpage, the HTML specification has link attributes specific to iframes that will cause links embedded within an iframe to behave in a certain way.
_blank can still be used inside an iframe to create a web page in a new browser tab. But it is not recommended if you want specific iframe behavior.
There are three iframe-specific link themes to choose from:
- Parents: It will open a link outside the iframe (as well as within the same webpage).
- _Self: The link will open within the same iframe (or the same web page) but only if the link is on the same domain. It will not work if the link is to another domain.
- _higher: It will open outside of an iframe (as well as within the same web page).
_ Attributes of free association
When it comes to the _blank link attribute, it can probably be generalized and simply used as long as you have a link attribute or noopener attached to it.
Still, it’s good to know that there are alternatives.
In the end, using the null attribute is as easy or as complex as you want it to be, and it depends on your specific needs.
- How to properly use the link title attribute
- 9 HTML tags (and 11 attributes) you should know for SEO
- Advanced Technical SEO: A Complete Guide
Featured image: Victoria Korbas/Shutterstock