3

I am starting to notice that more websites are beginning to implement Javascript logic that is geared at taking control of my online experience. One of ways they're doing this is detecting middle mouse button clicks so that links open in their proprietary viewer rather than in a new tab.

The two that are doing this the most are Bing and Facebook and I do not like it. When I middle-mouse-click an image from a Bing search or a photo from someone's FB album, the web page opens its proprietary modal-style window. However, I can right click on the link and open in new tab, but I prefer the middle click. Besides, some websites like Instagram are even modifying the right-click context menu so that you can't save images (at least not as easily), so it's probably only a matter of time before Bing and Facebook start doing something similar.

1

1 Answer 1

0

Short answer: No, but because that isn't what's happening.

The behavior you're experiencing is not what you think. Your browser uses middle click to open links in a new tab, however this is still interpreted by the site as a click. The site is not really aware that you are trying to open something in a new tab, so it just does whatever it normally would for a click.

When you click an image on Facebook and it pops up in a black box you haven't actually opened a new page, instead you just opened up another part of the one you were already on. Middle click will not change that, as this is an integral part of the way the page functions. Middle click may still open a page in a new tab, but this is the same page as you were already on, not a new page at all.

This is a newer design pattern, many sites are attempting to reduce page loads by showing content in one page, and dynamically fetching new content (using a technique called AJAX) and repopulating the page using JavaScript. A site like this has a more fluid UX, and for most people will be easier to use.

So can you disable this? Technically... yes, a complex user script could tear apart the page and remake it in the way you want it. But that's a lot of work without a whole lot of benefit. The websites developers put a lot of time into making it work the way it does, you would essentially need to rewrite the entire front end to make it behave the way you are describing. Again, this is not the site subverting the browser action in any way, the site is not doing anything wrong. What is happening is that lots of sites are now being designed in a way that doesn't fit the usage pattern you are familiar with. You can try disabling JavaScipt completely, but this is more likely to make the site unusable than to be helpful. Most major websites do try to make sure they don't break when you do this, but there are no guarantees.

Now I said the site isn't aware of which button you clicked, this is generally true, but it is possible for the site to find out. This question from Stack Overflow addresses the how: How to detect middle mouse button click?. The basic answer is that when a click event is fired, information about which button was clicked is available, and that can be used to determine how to handle the event. But most websites do not use that information, those that do are most likely games or other special kinds of interactive content.

2
  • It appears that you are right. I just made this fiddle jsfiddle.net/76yfJ and middle clicking triggers the onclick event. The reason why I assumed the site was detecting middle clicks was because, in my research of this, I saw JavaScript that claimed to be able to distinguish between left and middle click. Commented Nov 25, 2013 at 10:44
  • Oops. This is the correct fiddle: jsfiddle.net/76yfJ/1 Commented Nov 25, 2013 at 10:53

You must log in to answer this question.

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