有没有办法阻止chrome运行greasemonkey脚本,除了某些域名?我可以用location.href
做一些hackery,但是如果有一个更清洁的解决方案会很好。
当我通过拖动器script.user.js
安装到浏览器中时,脚本会自动为所有网站运行。
如何防止这种情况?
答案 0 :(得分:30)
使用@match
,如here所述。
示例:
// ==UserScript==
// @match http://*/*
// @match http://*.google.com/*
// @match http://www.google.com/*
// ==/UserScript==
答案 1 :(得分:3)
在元数据中使用@include @exclude标记? http://diveintogreasemonkey.org/helloworld/metadata.html