Normally, this combination opens a link as a new tab in Chrome, Firefox, and Safari for Macs. Is there any way to detect this? I know of jquery’s event.which, but it gives a value of 1, which is indistinguishable from a simple left click.
The use case is with Backbone HTML5 pushstate, where I want to attach a 'click' event handler that does not trigger a page load for normal navigation, yet still allow users to open a link in a new tab with a ⌘-⇧-click.
You can use the event’s
metaKeyandshiftKeyproperties:so if, for instance, you are doing
#!routing instead of actually following urls, and want command or command+shift to do normal behavior (open up in a new tab), you would have something like