我的Greasemonkey脚本无法安装 [英] My Greasemonkey script won't install
问题描述
我要编写一个小的Greasemonkey脚本.
这是我的测试代码:
I'm going to write a small Greasemonkey script.
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");
});
但是它不起作用.
我尝试从 userscripts.org 下载一些随机脚本,当我从网站上安装该脚本时,该脚本可以正常工作.但是,当我将源代码放入script.js
文件中,然后单击添加新脚本"时,它没有.
I tried downloading some random script from userscripts.org and it worked when I installed it from the website. But, when I put the source code into script.js
file and then clicked "Add a new script" - it did not.
请帮助.
推荐答案
当我将源代码放入script.js文件中,然后单击添加新脚本"时,它没有.
when I put the source code into script.js file and then clicked "Add a new script" - it did not.
文件名必须以.user.js
结尾.因此,将测试文件重命名为test.user.js
或其他名称.然后,您将能够安装它.
The filename must end with .user.js
. So rename your test file to test.user.js
or something. Then you will be able to install it.
这篇关于我的Greasemonkey脚本无法安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!