Prevent middle click Javascript void tab

Stops web browser from opening blank javascript:void(0) tabs when middle clicking on Javascipt links.

// ==UserScript==
// @name        Prevent middle click Javascript void tab
// @namespace   https://greasyfork.org/users/697378-reiver
// @match       *://*/*
// @grant       none
// @version     1.0
// @author      Reiver
// @description Stops web browser from opening blank javascript:void(0) tabs when middle clicking on Javascipt links.
// ==/UserScript==

$(document).on('auxclick', 'a[href^="javascript:"]', function (e) {
    if (e.button == 1) {
        e.preventDefault();
    }
});