开发者

How do I restrict chrome greasemonkey scripts to a single webpage, or just certain webpages?

开发者 https://www.devze.com 2023-03-13 16:13 出处:网络
Is there a way to prevent chrome from running greasemonkey scripts except for on certain domains? I could do some h开发者_高级运维ackery with location.href, but it would be nice if there were a cleane

Is there a way to prevent chrome from running greasemonkey scripts except for on certain domains? I could do some h开发者_高级运维ackery 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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号