This is my code:
// ==UserScript==
// @name Test1
// @namespace http://my_unique_namespace.com
// @version 1
// @include http*
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_log
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// ==/UserScript==
function testReq() {
GM_xmlhttpRequest({
method: "GET",
url: "http://www.google.com",
onload: function(response) {
alert(response.responseText);
},
onerror: function(reponse) {
alert('error');
}
});
}
testReq();
GM_log("This works");
/*
Exception: GM_xmlhttpRequest is not defined
testReq@Scratchpad/1:15
@Scratchpad/1:27
*/
My problem is that I'm getting the exception listed at the bottom of the code sample every time I run the script, but the GM_xmlhttpRequest seems to be working (I successfully get the response object).
Any ideas why this is happening?
Thank you.
Update: Greasemonkey 1.8 on Windows 7 Professional 64-bit