Disable middle mouse button scrolling

Prevents unintentional scrolling when opening a link in a new tab with middle mouse button

  1. // ==UserScript==
  2. // @name Disable middle mouse button scrolling
  3. // @description Prevents unintentional scrolling when opening a link in a new tab with middle mouse button
  4. // @version 20240913
  5. // @author mykarean
  6. // @icon https://cdn-icons-png.flaticon.com/128/12640/12640098.png
  7. // @source https://superuser.com/questions/44418/how-to-disable-the-middle-button-scrolling-in-chrome
  8. // @match *://*/*
  9. // @grant none
  10. // @run-at document-idle
  11. // @compatible chrome
  12. // @license GPL3
  13. // @noframes
  14. // @namespace https://greasyfork.org/users/1367334
  15. // ==/UserScript==
  16. document.addEventListener("mousedown", function(mouseEvent) {
  17. if (mouseEvent.button != 1) return;
  18. mouseEvent.preventDefault();
  19. mouseEvent.stopPropagation();
  20. }, true);