Javascript 未定义编码器组件

Javascript 未定义编码器组件,javascript,json,greasemonkey,Javascript,Json,Greasemonkey,我在GreaseMonkey沙箱中玩,试图制作一个脚本,将加载的页面转发到另一台服务器,以便通过POST进行处理。以下是脚本: // ==UserScript== // @name Mirror Page // @namespace mailto:linkhyrule5@gmail.com // @description POSTs page to dynamic page mirror // @include http://* // @include http

我在GreaseMonkey沙箱中玩,试图制作一个脚本,将加载的页面转发到另一台服务器,以便通过POST进行处理。以下是脚本:

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

var ihtml = document.body.innerHTML;
GM_xmlhttpRequest({
    method: 'POST',
    url: 'http://localhost:5723/index.php',
    data: "PageContents=" + encodeURIcomponent(ihtml) + "\nURL=" + encodeURIcomponent(document.URL),
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
});

不知何故,我得到的是,
encodeURIcomponent没有定义,即使它是一个全局函数,应该可以在JavaScript所在的任何地方使用。我想我误解了什么?你忘了大写字母C。。。它就像骆驼一样:

var ihtml = document.body.innerHTML;
GM_xmlhttpRequest({
    method: 'POST',
    url: 'http://localhost:5723/index.php',
    data: "PageContents=" + encodeURIComponent(ihtml) + "\nURL=" + encodeURIComponent(document.URL),
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
});

你需要资本
C
-
encodeURIComponent
。哦,该死的,真的吗?我现在觉得自己很蠢。我敢肯定就是这样。>>愚蠢的错误。我一核对就接受你的答复。是的,就是这样。那里的办公桌是我下个月的极客信用卡。不能再接受七分钟。@linkhyrule5是人类。我们总是犯错误。即使是最好的程序员。你只需要好好利用它