I'm making an app in AppJS, and the prompt()
function wont work. I've looked it up, tried window.prompt()
and many other things, but nothing has worked. I'm trying to see when the Esc key is pressed, then the person enters the password. If the password is correct, then the it will run window.close()
. The prompt
box does not popup.
window.addEventListener('keydown', function(e){
if(e.keyCode == 27){
var pw = prompt('Please enter the password.');
if(pw == 'password') window.close();
}
}, false);