[英]Disable windows button, alt e uppercase with javascript
I want to create application web "QUIZ ", In the application use the mouse only, I have disabled all keys except keys windows
, alt
,'num lock' and caps
button.我想创建应用程序 web “QUIZ”,在应用程序中仅使用鼠标,我已禁用除键windows
、 alt
、'num lock' 和caps
按钮之外的所有键。 I want Into application to disable the windows
, alt
and caps
button with the following code but it doesn't work:我希望 Into 应用程序使用以下代码禁用windows
、 alt
和caps
按钮,但它不起作用:
document.onkeydown = function (e) { return false; } $(document).keydown(function (event) { // Prevent ALT - Prevent left window key - Prevent caps lock if (event.keyCode == 18 || event.keyCode == 91 || event.keyCode == 20) { console.log("clicked", event.keyCode); return false; } });
This is not possible.这是不可能的。 If it were, it would be a security concern.如果是这样,那将是一个安全问题。 Websites can never modify standard browser or operating system behavior and it is a waste of time to try to do so, as bugs that allow it to be done will be fixed very quickly.网站永远不能修改标准浏览器或操作系统的行为,尝试这样做是浪费时间,因为允许这样做的错误将很快得到修复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.