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

查看:44
本文介绍了禁用 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 监听各种组合键并禁用默认行为.您甚至可以在此处使用和测试一个库.我刚刚在他们的演示文本区域中使用 google chrome 和 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天全站免登陆