[英]My Greasemonkey script won't install
I'm going to write a small Greasemonkey script. 我将编写一个小的Greasemonkey脚本。
Here is my test code: 这是我的测试代码:
// ==UserScript==
// @name test
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @namespace brak
// @description test
// @include http://forum.php.pl/*
// ==/UserScript==
$(document).ready(function(){
alert("OK");
});
But it doesn't work. 但这是行不通的。
I tried downloading some random script from userscripts.org and it worked when I installed it from the website. 我尝试从userscripts.org下载一些随机脚本,当我从网站安装该脚本时,它可以工作。 But, when I put the source code into
script.js
file and then clicked "Add a new script" - it did not. 但是,当我将源代码放入
script.js
文件中,然后单击“添加新脚本”时,它没有。
Please help. 请帮忙。
when I put the source code into script.js file and then clicked "Add a new script" - it did not.
当我将源代码放入script.js文件中,然后单击“添加新脚本”时,它没有。
The filename must end with .user.js
. 文件名必须以
.user.js
。 So rename your test file to test.user.js
or something. 因此,将测试文件重命名为
test.user.js
或其他名称。 Then you will be able to install it. 然后,您将能够安装它。
You can try changing 你可以尝试改变
// @include <a href="http://forum.php.pl/*" target="_blank">http://forum.php.pl/*</a>
To: 至:
// @include http://forum.php.pl/*
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.