3

I'm looking for a Firefox Quantum extension that can prevent links from opening in new tabs.

I was previously using TargetKiller for Firefox but it currently won't work with Quantum. In Chrome, I use Death To _blank. Both of these extensions force all links to open in the current tab instead of a new one by removing the HTML <a> target attributes: _blank and _new, from all links.

Extensions that use another method are fine as long as they can keep links from opening in new tabs. Allowing additional target attributes to be removed (like TargetKiller) is a good bonus feature, but I'm fine with an extension that just works on _blank and _new.

Descriptions of the two extensions I've used for reference:

  • TargetKiller

    TargetKiller is a small extension for the Firefox web browser. The extension removes the target attribute from links on the fly. You can specify which target attributes should get removed. By default TargetKiller is removing all target attributes which equals to _blank or _new.

  • Death To _blank

    Keeps links from opening new tabs by removing the _blank attribute

    Many web page links use the "_blank" target to open in a new tab. This is usually annoying (if I wanted to open a new tab, I would have done so myself!).

    Death To _blank removes the "_blank" target from links, causing them to open in the current tab. This script also catches a few other targets (such as "blank" and "_new") that developers use.

2 Answers 2

2

You could certainly do this with a short JavaScript such as

for (var e of document.getElementsByTagName("a"))
    {delete e._blank;
     delete e._new;}

but it might be too slow for pages with lots of links. Try it out.

1

You don't need an extension to prevent links from opening in new tabs. This can be done by setting browser.link.open_newwindow to 1 in about:config.

See: https://support.mozilla.org/en-US/questions/1190923

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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