問題描述
我正在使用 JavaScript、node.js 和 Electron 構建一個應用程序.
I am building an application using JavaScript, node.js, and Electron.
此應用程序的一部分旨在鎖定計算機,直到用戶進行身份驗證.
Part of this application is designed to lock the computer until the user authenticates themselves.
這可行,但是我需要讓我的應用程序禁用 alt + tab 鍵盤快捷鍵,因為目前用戶可以使用它來跳過我的鎖定頁面(并且從而能夠在沒有經過身份驗證的情況下使用計算機).
This works, however I need to make my application disable the alt + tab keyboard shortcut, as currently the user can use this to skip over my lock page (and thus be able to use the computer without having been authenticated).
任何建議將不勝感激.
推薦答案
您可以為窗口打開信息亭模式,使其全屏并始終在頂部,這樣您就無法轉到其他應用程序.
You could turn on kiosk mode for the window which makes it full screen and always on top so you can't go to another application.
您還可以使窗口透明并將登錄信息放置在屏幕中間,這樣看起來就好像屏幕中間有一個窗口,但您不能點擊屏幕的其他區域.
You could also make the window transparent and position the login in the middle of the screen so it appears as if there is one window in the middle of the screen but you can't click on other areas of the screen.
要處理 Alt+F4 可以使用 window.onbeforeunload
事件或調用 event.preventDefault()
close
事件中的 code>.
To handle for Alt+F4 you can use the window.onbeforeunload
event or call event.preventDefault()
in the close
event.
https://electron.atom.io/docs/api/browser-window/#event-close
這篇關于在電子應用程序中禁用鍵盤快捷鍵 Alt + Tab的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!