On my website, which is a one-page JS site using Sammy.js and jQuery, when I middle-click a link with a mouse, the link opens in a new tab. But when I command-click on a Mac, it
Here's the relevant code from sammy.js:
// bind to link clicks that have routes
$('a').live('click.history-' + this.app.eventNamespace(), function(e) {
if (e.isDefaultPrevented()) {
return;
}
var full_path = lp.fullPath(this);
if (this.hostname == window.location.hostname && app.lookupRoute('get', full_path)) {
e.preventDefault();
proxy.setLocation(full_path);
return false;
}
});
Summary: If someone clicks on a link, override the standard link behavior with sammy.js's behavior, which is to change the current page to show the content of the target page with no actual page load. According to dakdad's link, a command-click (unlike a middle-click) is caught by the click event, and can be overridden.
For a workaround, you could remove sammy.js's event handler (using $('a').die('click.history-' + _sammy_event_namespace_);
) and replace it with a modified version that checks for command-clicks and avoids overriding them.