I have the code below for identifying when the user press the ESC key. It works fine in Safari when the browser is not in fullscreen mode. But I can't make it work when it is in fullscreen mode. Any solution to this?
PS: it must work for the most used browsers.
jQuery(document).keyup(function(e) {
if (e.keyCode == 27) {
if (Math.round((document.getElementById("canvas").style.width.match(/\d+/g).map(Number) * 1.45)) > screen.availWidth) {
alert('Fullscreen');
}
}
});