Reputation: 3604
I'm new to greasemonkey and I've a script (which I'm serving) that uses GM_xmlhttpRequest. I was wondering what I've to reference in order to use this function. Like I said, I'm serving this script so I've no idea if the user has GreaseMonkey installed.
Thanks
Upvotes: 0
Views: 204
Reputation: 93443
You can not "serve" script that uses GM_xmlhttpRequest()
. GM_xmlhttpRequest()
will run in the protected Greasemonkey sandbox (or the protected Chrome userscript sandbox) only.
You can host a proper user script and ask that the user install it, but the user is under no obligation to do so.
If you want your page to have some king of cross-site AJAX capability, you cannot use GM_xmlhttpRequest()
in its JS. You'll have to use one of the standard workarounds.
Upvotes: 1
Reputation: 1
If you installed scripts appropriately (like from userscripts.org), the GreaseMonkey should be able to detect them. You can see what scripts are currently being used by right-clicking on the GreaseMonkey icon on the lower right-hand side of your screen. Some scripts work automatically, and some scripts require the browser to be restarted first. When Greasemonkey detects a page that a script applies to, it automatically runs the script. No need for you to do anything.
Upvotes: 0