Chrome 中的快捷键命令不会阻止默认操作

Shortcut Key commands in Chrome not preventing default action

所以我正在编写一个快捷方式库,并且在大多数情况下它都能正常工作,除了我立即发现的问题在 Chrome 中(因为我在chrome book) 是当按下 ctrl+n 时它会创建一个新的浏览器 window。基本上在 jist 中,我的代码检查是否定义了当前键选择,以及它是否是 preventDefault 和 运行 该命令的 exec 函数。

if(joinedKeys in commands.cmd)
    e.preventDefault();
    commands.cmd[joinedKeys].exec();

我什至试过这样做-

document.addEventListener("keydown",function(e){
    e.preventDefault();
});
//as well as window.addEvent...

都不行。关于停止浏览器的默认操作有什么建议吗?

In Chrome4, certain control key combinations have been reserved for browser usage only and can no longer be intercepted by the client side JavaScript in the web page. These restrictions did not exist in Chrome3 and are inconsistent with both Firefox3/3.5 and IE7/8 (on Windows).