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

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

问题描述

我有一个相当复杂的单页应用程序,有一个很好的小菜单系统(类似于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中的按钮的问题,请参阅答案丹尼尔怀特发布说不,这不可能做到。

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 Key?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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