Ver originalwindow.addEventListener("keyup", function(event){ var codigo = event.keyCode || event.which; if (codigo == 27){ //Cierras tu ventana }}, false);