0

I am trying to make a game where control activates an ability, and movement is bound to WASD. The problem is, holding down control and W at the same time kills the tab in Firefox

I'm looking for a way to disable this without having an intrusive "confirm" pop up box.

Ive tried this:

addEventListener(
  'beforeunload',
  function(e){
      e.stopPropagation();e.preventDefault();return false;
  },
  true
);

which apparently has worked in the past but now seems to be patched out. Ive tried methods that use the confirm box, but freezing the webpage every single time the user dares to hold control and w at the same time is irritating and disrupts the flow of gameplay.

what
  • 1
  • 1
    No; there has to be an easy way for the user to leave your tab. If this was allowed, you could almost entirely disable a user from closing your tab. – code Jun 02 '23 at 20:08

0 Answers0