How to run Tampermonkey on specific domains

Tampermonkey is a browser add-on that lets you run arbitrary JavaScript code on a webpage. As a web developer, it’s fun to make scripts to alter how a webpage (that you don’t control) feels and works.

However, with great power comes great responsibility to not mess up. Tampermonkey allows you to configure an allowlist (a.k.a whitelist) and a denylist (a.k.a blacklist). These lists can be configured on the SettingsSecurity menu of Tampermonkey in your browser itself.

Before starting, make sure that your Config Mode is set to Beginner or Advanced. You won’t get the settings if it is set as Novice.

Choose Beginner or Advanced, not Novice.

Then scroll to the security section and add the domain names to the Whitelisted Pages you want to allow the script to run, and add the domain names to block the script in the Blacklisted Pages section.

Add any domain names you want to allow/deny here.

Those lists accept Regex as their values. So, to add all pages from the domain example.com, use the format:

/https?:\/\/example\.com\/.*/

Have fun!