Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tampermonkey GM.xmlHttpRequest is not a function

I'm seriously struggling trying to resolve an issue with my script. Whatever I try and do GM.xmlHttpRequest throws error "is not a function".

The rest of my code works fine.

This is an abridged version of my code:

// ==UserScript==
// @name         FUT20 Autobuyer Menu
// @namespace    http://tampermonkey.net/
// @version      0.6
// @description  try to take over the world!
// @author       Rastor
// @match        https://www.easports.com/uk/fifa/ultimate-team/web-app/*
// @match        https://www.easports.com/fifa/ultimate-team/web-app/*
// @grant        GM.xmlHttpRequest
// ==/UserScript==

        try {
            GM.xmlHttpRequest({
              method: "GET",
              url: "http://www.example.com/",
              onload: function(response) {
                alert(response.responseText);
              }
            });
        }
        catch (err) {
            console.log(err);
        }
like image 783
Matt Bridges Avatar asked Mar 14 '26 00:03

Matt Bridges


1 Answers

In Tampermonkey it is GM_xmlhttpRequest (underscore not dot) as the privilege and function name!

like image 180
Alien426 Avatar answered Mar 16 '26 12:03

Alien426



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!