ReferenceError:未定义GM_xmlhttpRequest [英] ReferenceError: GM_xmlhttpRequest is not defined

查看:203
本文介绍了ReferenceError:未定义GM_xmlhttpRequest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在以下用户脚本代码中得到一个ReferenceError:

I get a ReferenceError in the following userscript code:

// ==UserScript==
// @name          ...
// @namespace     ...
// @description   ...
// @include       ...
// @grant         GM_xmlhttpRequest
// ==/UserScript==

console.log(GM_info);
try
{
    console.log(GM_xmlhttpRequest({ method: "GET", url: "http://google.ca/", synchronous: true }).readyState);
}
catch (e)
{
    console.log(e);
}
...

首先记录 GM_info 成功,然后记录ReferenceError。 (我正在使用Firefox / Firebug。)

It first logs GM_info successfully, then logs the ReferenceError. (I'm using Firefox/Firebug.)


ReferenceError:GM_xmlhttpRequest未定义

ReferenceError: GM_xmlhttpRequest is not defined

为什么我会收到此错误?

Why do I get this error?

推荐答案

重新安装脚本修复了问题。我不需要重新启动Firefox,但它可能对其他人有帮助。 Brock的回答为这类问题提供了有用的调试技巧。

Reinstalling the script fixed the problem. I didn't need to restart Firefox, but it may be helpful for other people. Brock's answer has helpful debugging tips for problems like this.

这篇关于ReferenceError:未定义GM_xmlhttpRequest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆