ReferenceError: GM_xmlhttpRequest is not defined

1,753 views
Skip to first unread message

JE

unread,
Sep 6, 2012, 11:34:21 AM9/6/12
to greasemon...@googlegroups.com
Hi,

I try to use a script which uses GM_xmlhttpRequest function.

Installed Greasemonkey at several PCs:

WIN XP
WIN 7/32
WIN 7/64

with different Java-Version. Greasemonkey is 1.0.
Disable Firewall
Disable/uninstall antivirus-software

But all the time I get the Error:

ReferenceError: GM_xmlhttpRequest is not defined
http://scripts.die-staemme.de/gm-scripts/DSsendReportsToOBST.js
Line 601

I can use other scripts without problems and other users say they can use the DSsendReportsToOBST.js without failure.

:^)

Thanks for suggestions or help.

Cheers
Jake

Anthony Lieuallen

unread,
Sep 6, 2012, 11:45:48 AM9/6/12
to greasemon...@googlegroups.com
Provide a link to the exact script in question.  Looks like you're creating a <script> node to a URL, which will not run in the script sandbox and thus not see the APIs.

JE

unread,
Sep 6, 2012, 1:31:04 PM9/6/12
to greasemon...@googlegroups.com
Hi,

I'm not shure that I understand you right.

The link to the script is here:

http://scripts.die-staemme.de/gm-scripts/DSsendReportsToOBST.js

It is called by this local script:

// ==UserScript==
// @name                DSsendReportsToOBST
// @author                Heinzel, Torridity
// @description            Hiermit kann man auf Tastendruck Berichte zu einem OBST-Server und DS Workbench schicken
// @namespace            die-staemme.de
// @include            http://*.die-staemme.de/game.php*screen=report*view=*
// ==/UserScript==

win = typeof unsafeWindow != 'undefined' ? unsafeWindow : window;
win.$.ajaxSetup({ cache: true });
win.$.getScript('http://scripts.die-staemme.de/gm-scripts/DSsendReportsToOBST.js');


Jay Rossiter / Signe

unread,
Sep 6, 2012, 1:44:40 PM9/6/12
to greasemon...@googlegroups.com

    You are loading a script into the unsafeWindow, which is outside the sandbox.  This is the same as if you were loading it directly in the browser - it doesn't have access to the sandboxed Greasemonkey functions.
--
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/greasemonkey-users/-/mLsWy-2j1lYJ.
To post to this group, send email to greasemon...@googlegroups.com.
To unsubscribe from this group, send email to greasemonkey-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.


-- 
Jay Rossiter					http://www.cothlamadh.net/
503.896.6187					si...@cothlamadh.net 

Anthony Lieuallen

unread,
Sep 6, 2012, 1:45:38 PM9/6/12
to greasemon...@googlegroups.com
I don't know what "$" is in this context, nor what getScript() does, but this is almost definitely loading the script into the content scope which cannot access the Greasemonkey sandbox.  You probably want @require.

http://wiki.greasespot.net/Metadata_Block#.40require

On Thu, Sep 6, 2012 at 1:31 PM, JE <ra...@ehrhardt.name> wrote:

Jay Rossiter / Signe

unread,
Sep 6, 2012, 2:02:34 PM9/6/12
to greasemon...@googlegroups.com

    $ would be jQuery - he's accessing the window's pre-existing instance and using the jQuery getScript method (http://api.jquery.com/jQuery.getScript/), but it's definitely loading in the unsafeWindow scope...
--
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to greasemon...@googlegroups.com.
To unsubscribe from this group, send email to greasemonkey-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
Reply all
Reply to author
Forward
0 new messages