在JavaScript / jQuery中捕获Ctrl-Alt-Del [英] Capturing Ctrl-Alt-Del in JavaScript/jQuery

查看:121
本文介绍了在JavaScript / jQuery中捕获Ctrl-Alt-Del的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在玩jQuery / JavaScript时我遇到了这个问题。我可以捕获 Alt Ctrl 键,但不能 Del ,当然也不能全部一起。

While just playing with jQuery/JavaScript I ran across this problem. I could capture Alt and Ctrl keys but NOT Del and certainly not all of them together.

$(document).ready(function() {
    $("#target").keydown(function(event) {
        if (event.ctrlKey && event.altKey && event.keyCode == '46') {
            alter("Ctrl-Alt-Del combination");
        }
    });
});

是否可以一起捕获所有这三个键?

Is it possible to capture all these three keys together?

推荐答案

我不确定其他操作系统,但我知道在Windows上, Ctrl + Alt + Del 是系统击键,在顶级截取,始终由Windows截取。据我所知,它不会再从那里传递,让你知道从它发出的任何东西都是正式的。

I'm not sure about other operating systems, but I know that on Windows, Ctrl+Alt+Del is a system keystroke, which is intercepted at the top level, always by Windows. As far as I know, it is not passed any further on from there, allowing you to KNOW that whatever comes up from it is official.

我知道Gnome(并且我相信KDE),它会触发关闭对话框,因此被窗口管理器捕获,而不会被传递。

I know that for Gnome (and I believe KDE), hitting it pulls up the shutdown dialog, and thus, is captured by the window manager, and not passed on.

所以,除非Mac只是忽略它,不,你不能得到那个特定的组合,因为它对操作系统的魔力。

So, unless Mac just ignores it, no, you cannot get that particular combination, due to its magic to the OS.

编辑:我注意到的一些事情,你有改变您的代码中不是 alert 。我不认为它会像这样工作。

just something I noticed, you have alter not alert in your code. I don't think it would work either way with it like that.

这篇关于在JavaScript / jQuery中捕获Ctrl-Alt-Del的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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