Is there a way to prevent chrome from running greasemonkey scripts except for on certain domains? I could do some hackery with location.href
, but it would be nice if there were a cleaner solution.
When I install by dragger script.user.js
into the browser, the script automatically runs for all websites.
How do I prevent this?
Tampermonkey is used to run so-called userscripts (sometimes also called Greasemonkey scripts) on websites. Userscripts are small computer programs that change the layout of a page, add or remove new functionality and content, or automate actions.
Tampermonkey is a donationware userscript manager that is available as a browser extension. This software enables the user to add and use userscripts, which are JavaScript programs that can be used to modify web pages.
Greasemonkey is a userscript manager made available as a Mozilla Firefox extension. It enables users to install scripts that make on-the-fly changes to web page content after or before the page is loaded in the browser (also known as augmented browsing).
They are not exclusive for Tampermonkey users and the codes you find will work on any user script managers, including Greasemonkey.
Use @match
, as described here.
Example:
// ==UserScript==
// @match http://*/*
// @match http://*.google.com/*
// @match http://www.google.com/*
// @match https://www.google.com/*
// ==/UserScript==
using @include @exclude tags in metadata?
http://diveintogreasemonkey.org/helloworld/metadata.html
https://wiki.greasespot.net/Metadata_Block
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With