Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is there a way to turn off a Tampermonkey script on every website except for those I choose?

I have a Tampermonkey script that is enabled on all websites. How can I make this script only run on one or some websites? I went into the script settings and found the Includes/Excludes text fields there, what should I do next?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If you want a script to only run on some sites, you should change the script’s @include or @match blocks accordingly. For example, taken from GM’s wiki:

// ==UserScript==
// @include     http://www.example.com/foo/*
// @include     http://www.example.org/*.bar
// @exclude     http://www.example.com/foo/baz
// ==/UserScript==

will run on example.com/foo/, and on example.com when bar is included in the rest of the URL – except when the path is foo/baz.

You can use either globs or regular expressions in @include. For regular expressions, surround the expression with a single slash, eg:

// @include    /^example\.com$/
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading