How to disable mouse gestures in edge browser with JavaScript?【The key is the edge browser】

158 Views Asked by At

I want to disable mouse gestures in edge browser with JavaScript,Because it interferes with my right-drawing function

I tried some event monitoring, but it didn't work


<!doctype html>
<html lang='en'>
<head>
  <meta charset='UTF-8'>
  <meta name='viewport'
        content='width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0'>
  <meta http-equiv='X-UA-Compatible' content='ie=edge'>
  <title>edge mouse gestures</title>
</head>
<body>

<script>
  const fn = (e) => {
    e.preventDefault()
    e.stopPropagation()
  }
  document.addEventListener('mousedown', fn)
  document.addEventListener('contextmenu', fn)
  document.addEventListener('mousemove', fn)
  document.addEventListener('touchstart', fn, false)
  document.addEventListener('touchend', fn, false)
  document.addEventListener('touchmove', fn, false)
  window.addEventListener('mousedown', fn)
  window.addEventListener('contextmenu', fn)
  window.addEventListener('mousemove', fn)
  window.addEventListener('touchstart', fn, false)
  window.addEventListener('touchend', fn, false)
  window.addEventListener('touchmove', fn, false)
</script>
</body>
</html>
0

There are 0 best solutions below