Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a solution to forbid links in Google Chrome to open new tabs (in most cases it is a target="_blank" issue).

So, I want all links to open pages in currently active tab, not in new tab.

I tried a wide range of addons (for ex. "Death to target=_blank") and greasemonkey scripts that are supposed to remove target=_blank attribute but none of them worked.

It is extremally anoying when I want to switch between accounts in GMail or navigate from GMail to GDrive. I always get the new tab opened and I need to close last tab manually.

share|improve this question

You can use a pure Javascript method:

var links = document.querySelectorAll('a[target="_blank"]');
for (var i = 0; i < links.length; i++) links[i].target = '';

Or you can use jQuery:

$('a[target="_blank"]').each(function() {
  this.target = '';
});

Then create an extension with it and install it to your browser. Chrome Developer Page

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .