2

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

Julian
  • 111
  • 3
  • 9

1 Answers1

-1

This happened about 1 month ago in google-chrome-beta.i386 for Fedora 17. Removed beta. Installed google-chrome-stable.i386. Problem resolved.

On latest update today for chrome-stable this problem reoccurs. Version is 27.0.1453.93.

Script in question which runs GM_xmlhttpRequest is a .user.js script installed manually into Extensions.

There
  • 498
  • 6
  • 18