<html id="page" onkeydown="return false">
<script>
document.addEventListener('keydown', function (event) {
if (event.key != "Escape") {
//do anything that you can stop this function here...
}
});
</script>
<!-- your codes here! such as <head>... <body> and others...... -->
</html>