Do more on the web, with a fast and secure browser!

Download Opera browser with:

  • built-in ad blocker
  • battery saver
  • free VPN
Download Opera

Can I ignore target attribute?

  • Is there a way in new Operas to ignore the target attribute of links (to prevent opening in new tabs)?

  • I don't think userCSS or userJS available as yet, but you might be able should be able to do with js as a bookmarklet...

    Start at Userscripts.org but I think there are a number of such sources....

  • I've ended up installing Violent monkey extension and making my own script for this. In case someone cares, the source is:

    // ==UserScript==
    // @name Ignore link target
    // @author veggen
    // @description Ignores the target attribute on links.
    // @version 0.1
    // @include *
    // ==/UserScript==
    
    [].forEach.call(
      document.querySelectorAll('a[target]'), 
      function(targettedLink){
        targettedLink.removeAttribute("target");
      }
    );
  • Originally posted by veggen:

    I've ended up installing Violent monkey extension and making my own script for this. In case someone cares, the source is:

    thank you for this
    :up:

  • @veggen
    I think it stopped working today
    When I want to download photo from facebook, it opens new empty tab
    It wans't like that before

    I take that back
    It works fine again
    honestly, don't know what happened
    for some reason some of the scripts and extensions stopped working (your script, facebook redirect fixer extension etc)
    but everything seems fine now

  • What's the difference between TamperMonkey and ViolentMonkey?

  • Don't tamper with a violent monkey!

    Eh ... what was the question?

  • Never mind. They're just script managers. 😛

Locked