5 ms·
I Believe in the Middle Click
- iwwr 16y agoI hate javascript links that can't be opened in new tabs.
- ionfish 16y agoOne of the strange things I've always found in Safari is that while some sites break Cmd+click (to open in a new tab), if you use the menu (right click > Open Link in New Tab) then that will work just fine.
- jacobolus 16y agoThe site is intercepting the click event, whether ⌘ is held down or not, but not right click (and maybe also not ⌃ click). When you ⌘-click, the “open in a new tab” behavior never fires, but when you choose the menu option, it does. It’s annoying, but not inexplicable.
- chc 16y agoThe codepath for right-click and control-click is the same unless you go pretty far out of your way to discriminate — that's why both methods of opening the contextual menu work.
- moeffju 16y agoThis is about CMD-Click, not CTRL-Click. CMD-Click sends a 'click' event to the page, since it counts as "left (primary mouse button) click", not "right click".
- chc 16y agoI was responding to jacobolus, who noted that many sites intercept clicks, "but not right click (and maybe also not ⌃ click)" (on the Mac, "⌃" is the symbol for the control key). I was explaining that those are pretty much the same thing from the program's point of view, so code that allows right-click will almost certainly also allow control-click.
- jacobolus 16y agoThis is incorrect. In Safari at least, if you attach a handler to the mousedown event, your handler will fire for both ⌃-click and right click, but the two events will be different. In the former case, you have event.button = 0, and event.ctrlKey = true. In the second case, you have event.button = 2, and event.ctrlKey = false. What happens depends on the logic inside the handler. On the other hand, if you attach a handler to the click event, it doesn't seem to fire for either right click or ⌃-click.
- president 16y agoI've noticed this behaviour in Chrome and Firefox as well.
- phillco 16y agoYes! I noticed this in Chrome, too, while trying to debug our web application. Turns out it's a Webkit bug. Tore my hair out trying to figure out why middle-click wasn't working, until I opened the same page in Firefox and voila, worked perfectly.
- yuvadam 16y agoThank god for Greasemonkey.
- hdragomir 16y agoI know, but you can't Greasemonkey everything, eh? I do that too, for what I visit regularly and presents said problem... but it can sometimes hit unexpectedly.
- mauriciob 16y agoSo many apps and sites lack this "feature". Because of that, now I need to call it what it isn't.
- pavel_lishin 16y agoI have never run into this problem, and didn't see anyplace where Delicious does this... is it really that common? (Aside from the middle-click-js-link-and-weep thing?)
- hdragomir 16y agoDelicious seem to have gone back to the original behavior: Middle Click opens a new tab. But, generally speaking, developers don't really take this into account.
- pavel_lishin 16y agoSmall pond over here, but I don't know any developers who specifically override the middle-click functionality - though the javascript link is something even I've done.
- hdragomir 16y agoYou don't specifically override the middle click. It happens when you override the click behavior -- middle click is included in that because it's still a click event, but with a slight difference in the event object being created. :-)
- Semiapies 16y agoLiveJournal blocks middle-click on some pages (but not all).
- baddox 16y agoYouTube does it on your Subscriptions page (at least with Chrome). If you middle-click on a link to one of the new videos, it just loads that video in the current tab. Right-clicking and clicking Open Link in New Tab works as expected, however.
- TomasSedovic 16y agoI love and use this idea, but the OP missed the Shift key. At least Firefox and Chromium use Shift+click to open the link in a new window and I'm pretty sure IE does that as well but I can't test that now. This is what I use: $('.some-snazzy-selector').click(function(ev){ if( ev.which == 2 || ev.metaKey || ev.ctrlKey || ev.shiftKey ) return true; e.preventDefault(); /* Awesome AJAX code goes here */ }); I posted this comment on the blog, but it may reach someone else here, too.
- hdragomir 16y agoYep, thank you. Post updated.
- marcusEting 16y agoI believed in the middle click, too, and lots of other special clicks... until I switched to a MBP. The I customized the touchpad using the Better Touch Tool and I haven't looked back since! :)
- deleted 16y ago[deleted]
- hammock 16y agoI use FF extension called DblClicker which lets me double-click a link into a new tab. It also closes (or duplicates) open tabs with a double-click. Started using this when the middle-click on my mouse broke from too much use.