php - Programmatically enter keystroke javascript
one text
Solution:
I think this is what you are looking for:
document.addEventListener('keydown', function(event) {
if(event.key == "Control" && event.key == "w") {
close();
}
});
Source