4 ms·
One 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 L
by ionfish 16y ago
One 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.