Is It Possible To Disable Esc/f11 Key During Full Screen Mode Of Webpage, Programmatically?
Is it possible to disable esc/F11 key during full screen mode of webpage, programmatically? I need to have an exit button within the webpage to exit from fullscreen mode, but need
Solution 1:
With jQuery you can disable it listening to the keydown event:
$(document).on("keydown",function(ev){
console.log(ev.keyCode);
if(ev.keyCode===27||ev.keyCode===122) returnfalse
})
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
keycode 27 stands for the ESC key and 122 for the F11. This was tested in chrome, maybe for other browsers can be other number
Solution 2:
document.addEventListener("keydown", e => {
if(e.key == "F11") e.preventDefault();
});
Post a Comment for "Is It Possible To Disable Esc/f11 Key During Full Screen Mode Of Webpage, Programmatically?"