Hacker News new | ask | show | jobs
by garethadams 4647 days ago
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?

2 comments

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.