Link Sanitizer

Clean up unnecessary hyperlink redirections and link shims

Daily installs
Total installs
10 0 2
Applies to
All sites


Link Sanitizer is a simple and efficient userscript for Violentmonkey and Greasemonkey browser addons. It will "sanitize" links on all webpages using a simple set of common rules. This includes removing trackers, link shims, and other bloated hyperlink redirects. In addition to this script, it is a good idea to use Privacy Badger, who specializes on some nasty Facebook and Google deeplink trackers.


  1. Install Violentmonkey or Greasemonkey userscript manager addon in your browser.
  2. Open Link Sanitizer file. Your userscript manager should recognize and install it.

Known Issues

Userscripts and Content Security Policies

Userscripts won't work on websites implementing restrictive Content Security Policies (e.g.,, or Currently the only way to make ViolentMonkey or GreaseMonkey work on all sites is to disable the CSP protection, which is generally not recommended.

The corresponding setting in Firefox about:config is:

security.csp.enable = false

On Chrome, the CSP can be overridden by extensions Content Security Policy Override, UnXSS or Caspr Enforcer.

The development progress on this issue for Mozilla is here, the discussion on Greasemonkey code is here.

Firefox addons on "superior" domains

Mozilla decided that Firefox simply disables addons for domains which are regarded as superior to user and his freedom. These domains are unsurprisingly owned by Mozilla. To get rid of this nasty "superior domain list" and enable addons everywhere, set in about:config:

extensions.webextensions.restrictedDomains = ""

Firefox and AddonManagerAPI on

Addons are also disabled for the domain, which can access the hidden AddonManagerWebAPI exposed by Firefox. This Firefox behavior is hardcoded. To make userscripts work on, first turn off Firefox and then add into the ~/.mozilla/firefox/PROFILE.default/prefs.js file:

user_pref("privacy.resistFingerprinting.block_mozAddonManager", true);

NOTE: Your path to the prefs.js might differ. See mozillazine article or dev docs on editing user preferences.

NOTE: This setting is hidden and not available in about:config, it has to be added into the prefs.js manually.

NOTE: You will be able to install plugins as usual, but the website will not be able to see which addons are already installed or otherwise manipulate them.


Tested with Violentmonkey and Greasemonkey on Firefox 60,61,63 and Chromium 70. Tampermonkey was not tested due to its cumbersome legal status, see


This userscript is maintained by


This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published here: