Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.