Restore my browser's middle-click behaviour

2

Some sites do annoying things with JavaScript, like replace the default behaviour of the browser to open a new tab on middle click, with code such as:

<a href="http://stackoverflow.com"
 onclick="window.location.href='http://stackoverflow.com'; return false;">
 Stack Overflow</a>

Is there any way I can give control back to my browser so that I'm the one that decides when a new tab gets opened or not? Right now I have to resort to either right clicking on the link and selecting Open link in new tab, or middle clicking on my browser's Back button after being rudely navigated away.

Dave

Posted 2012-08-31T13:45:01.747

Reputation: 308

so you want to change what window.location.href does? – None – 2012-08-31T13:48:59.837

I don't see how the code you show would specifically open links in a new tab unless your browser is configured to do so. What browser are you using? – GFK – 2012-08-31T13:59:45.327

Disable JavaScript. – None – 2012-08-31T14:03:01.943

Answers

2

You haven't stated which browser you're using, but I found this extension for Chrome. I haven't tested it extensively, but it works for twitter.com, which by default pops up a little profile box when middle-clicking on someone's twitter handle, rather than open their full profile in a new tab.

Cam Jackson

Posted 2012-08-31T13:45:01.747

Reputation: 2 267

That links now 404s – cletus – 2019-06-12T15:10:22.250

Just installed that extension and it works! – Syntax Error – 2013-08-29T16:52:36.273