The Middle Click

When middle-clicking a link, I expect it to open in a new tab, not reload the current page.

This is part of my workflow when going through a list of links, or thumbnails, and I want to open several -- or at least keep the list open for when I'm done with each link.
I find it very annoying when websites override this simple browser behavior, via Javascript.

While I too override the default behavior in my applications -- to make room for Ajax, for instance -- I allow users to middle click the link and open the page in a new tab. Because if they middle click, that's what they want and who the hell am I to tell them they're wrong ,eh?

I do this by adding this bit of code to the beginning of my click handlers

$('.some-snazzy-selector').click(function(ev){
    if( ev.which == 2 || ev.metaKey || ev.ctrlKey || ev.shiftKey ){
        return true;
    }
});

This snippet I picked up from Kyle Neath also allows the user to open a new tab by holding down the shift key, or control key, or command key for the Mac users.

Delicious, I'm looking at you! Let me middle click your links, dammit!

Filed under  //

Viewed  // 
times