'Event binding Ctrl-Shift-N in Chrome

I'm using to jQuery.hotkeys to bind keyboard events.

I'm trying to bind Ctrl+Shift+N

$(document).bind('keydown', 'ctrl+shift+n', function(e) {
    e.preventDefault();
    alert('Ctrl+Shift+N');
    return false;
});

The above is not working. Any ideas?



Solution 1:[1]

Chrome doesn't let you take over some shortcuts.

If you use the following code http://jsfiddle.net/rNkmA/1/

$(document).bind('keydown', function(e) {
    console.log(e.which);
    console.log(e.ctrlKey);
    console.log(e.shiftKey);
    if (e.ctrlKey && e.shiftKey && e.which === 78) {
        e.preventDefault();
        console.log('Ctrl+Shift+N');
        return false;
    }
});?

You'll see that the handler never gets called in Chrome

I suggest you use a shortcut that is not preassigned to chrome like alt+shift+n. That will work in FF, IE, Safari and Chrome (does anybody ever test for Opera?)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eleanor Zimmermann