Hacker News new | ask | show | jobs
by jonahx 4643 days ago
I agree and don't like to be forced to open external links in the same tab. I've actually written a tampermonkey script to override the default behavior of HN and SO for this reason.

But I hesitate to make this comment as this debate can approach the intensity of the "vim/emacs" debate in its religious fervor.

1 comments

I don't think 'be forced' means what you think it means.

If a site defaults its links to "same tab" then I can easily override that behaviour and open them in new tabs if I choose (just by using a different mouse button or holding down a key when I click)

If a site defaults links to "new tab", can you tell me the simplest way I can override that behaviour?

I will help you, despite your snarkiness :)

Just use greasemonkey or tampermonkey and a script like this:

    var a = document.getElementsByTagName("a"); 
    for (i=0;i<a.length;i++) { 
        if (a[i].target="_blank") { 
            a[i].target="_self" 
        }                        
    }
It should work for the majority of cases. You should be able to tweak it to handle any exceptions.
Drag the link and drop it into the URL bar of your browser.