31

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?

Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406

2 Answers2

46

Use @match, as described here.

Example:

// ==UserScript==
// @match http://*/*
// @match http://*.google.com/*
// @match http://www.google.com/*
// @match https://www.google.com/*
// ==/UserScript==
Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
4

using @include @exclude tags in metadata? http://diveintogreasemonkey.org/helloworld/metadata.html https://wiki.greasespot.net/Metadata_Block

Satish
  • 6,457
  • 8
  • 43
  • 63