6

I use Chromium. Many times, I am following links, from one page to another, and I am done with the current tab and don't want to open a link that might possibly open in a new tab. I tried some combination of Ctrl, Shift, Alt and mouse click, but the link still opens in a new tab. Can it be done, if at all?

2
  • Do you want to force Chrome to open new pages in new window,and not in tab?
    – karthick87
    Dec 10, 2010 at 11:13
  • n, in the same tab, in the same window. and its chromium, not chrome. Dec 10, 2010 at 11:55

3 Answers 3

4

You can add a little user script to break target="_blank":

var a = document.getElementsByTagName("a");
for (i=0; i<a.length; i++)
    if (a[i].target == "_blank")
        a[i].target = "_self";

How you get something like that to run is another question.

You need to run Chromium with --enable-user-scripts so you need to alter your launchers (right click the menu, edit menus, etc). The command should be:

chromium-browser %U --enable-user-scripts

Then you need to save the script:

mkdir ~/.config/chromium/Default/User\ Scripts/
gedit ~/.config/chromium/Default/User\ Scripts/target-eater.user.js

Paste in the script, save and edit gedit. Launch chromium with --enable-user-scripts and the script should automatically load and start nuking _blanks

2

In earlier years of web design it was more common for designers to make all external URLs open in new windows, but increasingly it is considered poor practice because, as you have discovered, it takes control away from the user.

The article Should Links Open In New Windows? makes a good point-by-point argument in support of this view.

Hackish workarounds that dynamically strip the target="blank" attribute in your web browser exist, but you should not have to use them. These workarounds only treat the symptoms.

The only solution

Write to the webmasters of problematic sites and politely explain how disrespectful and hostile the overuse of target="blank" is. Point out how links that open in new windows break the visitor's back button, creating a obstacle for users trying to return to their site. Make the case that their design forcefully robs users of the choice to control their own computer.

If users speak up about this problem, maybe, with time, we won't have to resort to the other answers workarounds posted here anymore.

1

If you drag the link onto the tab (eg. the one you are using!), it will open the link in that tab.

2
  • Think he wants the opposite. If a tab /should/ open in a new tab, he wants a modifier that will force that tab to open in the current tab and window. I'm not aware of any modified that does this. Oli's answer is awesome, but it will override the default behaviour, rather than using a toggle/modifer.
    – Scaine
    Dec 10, 2010 at 12:01
  • 2
    As Roddie says: you can drag a link to the tab and it will be loaded in that tab, and this works whether it's the same tab (as Kaustubh P wants) or another tab. But of course it's not a click-modifier...
    – JanC
    Dec 10, 2010 at 15:32

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.