2

I'm looking for a Firefox Quantum extension or user JavaScript that can remove the HTML <a> target attributes _blank and _new from all links.

I was previously using TargetKiller for Firefox but it currently won't work with Quantum. In Chrome, I use Death To _blank. TargetKiller can be specified to remove additional target attributes but I'm fine with an extension that just works on _blank and _new.

Descriptions of the two extensions 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.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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