I want when a person presses the shift key a tab opens and the previous one closes but I can not.
<script>
function keyCode(event) {
var x = event.keyCode;
var y = event.keyCode;
if (x == 16) { // 16 is the Shift key
window.open('https://google.com.br' , '_blank')
Window.close();
}
}
</script>
But it only opens and does not close the previous one.