Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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=""
 onclick="window.location.href=''; 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.

share|improve this question

migrated from Sep 1 '12 at 13:33

This question came from our site for professional and enthusiast programmers.

so you want to change what window.location.href does? – Matt K Aug 31 '12 at 13:48
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 Aug 31 '12 at 13:59
Disable JavaScript. – Florent Aug 31 '12 at 14:03

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, 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.

share|improve this answer
Just installed that extension and it works! – Syntax Error Aug 29 '13 at 16:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .