How to press the ESC key on the site?

  • 0
    You need to make sure that the ESC key is automatically pressed on the site every 10 seconds. As I understand it, this can be done through javascript, which I do not understand at all. You don't need to tie it to anything on the site. This is necessary so that it does not kick from one service.
    JavaScript Anonymous, May 27, 2019

  • 1 Answers
  • 0
    document.addEventListener('keydown', function(e){ 
    console.log(e.keyCode);
    });

    var eventESC = new KeyboardEvent('keydown', {'keyCode':27});
    var timer10Seconds = setInterval(() => document.dispatchEvent(eventESC), 10000);
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!