Javascript Erorr访问GreaseMonkey沙盒API

Javascript Erorr访问GreaseMonkey沙盒API,javascript,greasemonkey,Javascript,Greasemonkey,是的,基本上还是老问题。在编写我的第一个GreaseMonkey脚本时,脚本告诉我没有定义GM_xmlhttpRequest。经过进一步调查-我不认为我可以访问API的一般,GM_信息给了我同样的问题 以下是完整的脚本: // ==UserScript== // @name Mirror Page // @namespace mailto:linkhyrule5@gmail.com // @description POSTs page to dynamic page mirro

是的,基本上还是老问题。在编写我的第一个GreaseMonkey脚本时,脚本告诉我没有定义GM_xmlhttpRequest。经过进一步调查-我不认为我可以访问API的一般,GM_信息给了我同样的问题

以下是完整的脚本:

// ==UserScript==
// @name        Mirror Page
// @namespace   mailto:linkhyrule5@gmail.com
// @description POSTs page to dynamic page mirror
// @include     http://www.google.com
// @version     1
// @grant       GM_xmlhttpRequest
// @grant       GM_info
// ==/UserScript==

console.log(GM_info);
var ihtml = document.body.innerHTML;
GM_xmlhttpRequest({
 method:'POST',
 url:'http://localhost:5723/index.php',
 data:"PageContents=" + escape(ihtml) + "\nURL=" + escape(document.URL),
 headers: {'Content-Type': 'application/x-www-form-urlencoded'}
});
在谷歌主页上找到我

/*
Exception: ReferenceError: GM_info is not defined
@Scratchpad/1:11:1
*/
而且,前面没有定义GM_xmlhttpRequest

在Firefox45.0上运行GreaseMonkey 3.7。我已重新启动Firefox并启用/禁用;该脚本完全存在于我的剪贴板和沙盒中,但就“删除脚本并从剪贴板中重新创建”而言,我还重新安装了该脚本


我现在已经尝试将该文件复制到.user.js文件中并从那里安装;仍然不起作用。

事实证明,草稿行中的“重新加载并运行”选项不适用于任何需要Greasemonkey沙盒的脚本,正如所发现的那样