是否可以从 Web 浏览器阻止 Windows 键? [英] Is it possible to block the Windows Key from a web browser?

查看:34
本文介绍了是否可以从 Web 浏览器阻止 Windows 键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个相当复杂的单页应用程序,有一个漂亮的小菜单系统(类似于 Windows 8 开始菜单).我希望我的用户在我的应用程序中点击 Windows 键来打开这个菜单.我已成功运行此功能,但它还会显示 Microsoft Windows 开始菜单.

I have a fairly sophisticated Single Page Application, with a nice little menu system (similar to Windows 8 start menu). I'd like for my users to hit the Windows key to open this menu when within my application. I have this successfully functioning, however it also brings up the Microsoft Windows start menu.

当我在我的网络应用程序中点击 Windows 键时,有没有办法(通过网络浏览器)我可以阻止"Microsoft Windows 开始菜单出现?

Is there a way (from a web browser) I can "block" the Microsoft Windows Start Menu from appearing when I hit the Windows Key within my web app?

我正在使用最新的 jQuery、knockoutJS 和任何必要的 JavaScript 插件来完成这项任务.

I'm using latest jQuery, knockoutJS, and any necessary JavaScript plugin to accomplish this task.

推荐答案

为按钮操作编写自定义绑定处理程序 -

Write a custom binding handler for your button action -

ko.bindingHandlers.windowsKey = {
    init: function (element, valueAccessor, allBindingsAccessor, viewModel) {
        var value = ko.utils.unwrapObservable(valueAccessor());

        $(element).keydown(function (e) {
            if (e.which === 91 || e.which == 93) {
                value(viewModel);
            }
        });
    }
};

关于是否可以从浏览器中禁用 Windows 中的按钮的问题,请参阅 Daniel White 发布的答案,不,这是不可能的.

As per the question of whether you can disable a button in Windows from the browser, see the answer that Daniel White posted that no, this cannot be done.

这篇关于是否可以从 Web 浏览器阻止 Windows 键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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