Links with target='_blank' not opening

Languages: English | Japanese

Table of Contents

Published Date:

Last Updated:

Troubleshooting Disqus target_blank noopener noreferrer Affiliate Link External Link Chrome Safari Hugo

Conclusion

On this blog, I use target="_blank" for external links to open them in a new tab by default.

However, when I published an article to the production environment and viewed it, I encountered a phenomenon where external links would not open correctly. Specifically, in Google Chrome, the address bar displays about:blank, and a blank page opens in a new tab. In Safari, the URL of the original page is displayed in the address bar, and a blank page opens in a new tab.

What’s even stranger is that this behavior is not consistent. For example, sometimes the link opens correctly the first time, but subsequent attempts result in a blank tab. Other times, a blank tab opens from the very first click.

Furthermore, if I right-click and select “Open in new tab” or Command + click, it opens normally.

In summary 👇️

What is this… I want to know the cause…

Cause

While investigating the JavaScript that captures click events, I found that a script from Disqus was involved. Disqus is a service that allows you to add comments to websites and blogs. It seems to have gained popularity from its launch around 2007 to around 2013. Since then, articles about “installing Disqus” are still seen, and I also installed it on this blog, which is built with Hugo. That was in early August 2024.

Disqus has an Affiliate Links feature that automatically replaces external links with affiliate links. It seems they generate revenue from this.

This is enabled by default when you create a new site on Disqus.

When this is enabled, it captures clicks on links within the article with a script and redirects to the affiliate link destination. By disabling this feature, the script is no longer loaded, and external links can now be opened in a new tab normally.

I suspect that the process of redirecting to a link fetched asynchronously after opening a new tab was failing for some reason.

I also considered the story that changing the new tab’s location to the affiliate link with opener was failing because of the noopener attribute, but that would be a fatal bug that would prevent all target="_blank" links from opening, and I don’t think location is the way to change the URL of a new tab from the original tab anyway…

Hmm, I don’t really get it.

Solution

Addendum 2025-09-14

Checking the behavior now,

I was able to navigate without any problems.

Test page:

At the time of writing, the behavior was definitely as described at the beginning of the article…

What attributes should <a> tags have to open in a new tab?

I took this as a good opportunity to look into it again.

Therefore

I found out.

Summary

The detailed mechanism of the script embedded by Disqus and the reason why the link opens correctly the first time but results in a blank tab on subsequent attempts are still unclear, but I’m glad to know that noreferrer is no longer necessary.

Actually, ads have started appearing in the Disqus comment section, so I’m thinking of removing it…

Share on: X Facebook Hatena