禁用Internet Explorer快捷键 [英] Disable Internet Explorer shortcut keys

查看:330
本文介绍了禁用Internet Explorer快捷键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


编辑:等了一会儿之后还没有得到任何东西,我已经决定
只为
做快捷方式禁用东西IE现在。是否有可能禁用
IE快捷键来访问菜单/打印
等通过vbscript?

After waited a while and didn't get anything yet, I've decided to do shortcut disable thingy only for IE now. Is there a possibility to disable IE shortcut keys to access menus/print etc. via vbscript?

是否可以禁用浏览器快捷键?

Is it possible to disable browser shortkeys?

因为其中许多人正在申请中使用。例如, Ctrl + p 正在使用,我不希望浏览器弹出打印窗口。

Because many of them are using in application. For instance, Ctrl+p is using and I don't want browser to popup the print window.

推荐答案

是的,您可以使用javascript监听各种组合键并禁用默认行为。甚至还有一个图书馆,你可以使用它来测试这里。我刚刚在他们的演示textarea中使用谷歌浏览器和Firefox来测试它,它可以按你的需要工作。

Yes, you can listen for the various key combinations with javascript and disable the default behaviors. There's even a library that you can use and test here. I just tested it using google chrome and firefox in their demo textarea, and it works as you want.

shortcut.add("Ctrl+P",function() {
    return;
});

这适用于我上面列出的浏览器,但IE不允许你覆盖默认行为在某些情况下。

This works in the browsers that I listed above, but IE will not allow you to override the default behavior in some cases.

IE中唯一的选择是完全禁用Ctrl键,例如:

Your only option in IE is to disable the Ctrl key entirely with something like:

document.onkeydown = function () { 
  if (event.keyCode == 17) alert('Ctrl Key is disabled'); 
};

哪个不理想,可能不是你想要的,但它会起作用。

Which is not ideal and probably not what you want, but it will work.

这篇关于禁用Internet Explorer快捷键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆