Disable Internet Explorer shortcut keys

前端 未结 6 786
臣服心动
臣服心动 2020-12-17 00:52

EDIT: After waited a while and didn\'t get anything yet, I\'ve decided to do shortcut disable thingy only for IE now. Is there a possib

6条回答
  •  暖寄归人
    2020-12-17 01:22

    You can try creating an event handler for keydown event, check on the keyCode and prevent its default action if needed. However this will not work in all browsers.

    An example for Firefox (canceling "Print" short key, verified):

    document.addEventListener("keydown", function(oEvent) {
        if (oEvent.keyCode == 80 && oEvent.ctrlKey)
            oEvent.preventDefault();
    }, false)
    

提交回复
热议问题