My goal
I am developing an online mouse tester, where users can test left/middle/right/forward/back button. I use mousedown event and MouseEvent.button to detect buttons. It works on Chrome 127.0.6533.88 . It doesn’t work on Firefox 128.0.3 .
Reproduction
- Open the JS Bin live demo (you may need to click “Run with JS”)
- In Chrome, click forward button and back button, and you will see 4 and 3 in the console
- In Firefox, click forward button and back button, and there will be no output in the console
Live demo: https://jsbin.com/qucofakebi/1/edit?html,console,output
Demo code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script>
document.addEventListener('mousedown',e=>console.log(e.button))
</script>
</head>
<body>
</body>
</html>