https://bugs.kde.org/show_bug.cgi?id=466719

--- Comment #1 from Schimon Jehudah <sjeh...@yandex.com> ---
Makyen has offered a solution:

> In Greasemonkey 4, GM.xmlHttpRequest() is the "new" name for making requests 
> from userscripts which use the elevated permissions available to browser 
> extensions. This allows it to be able to do things which in-page requests 
> can't do.
> 
> For all other userscript managers, including Greasemonkey 3, the name for 
> that function is GM_xmlhttpRequest. The two functions are largely identical 
> across userscript managers, as long as you stick to using the on* properties 
> in the object you pass as the argument. Some userscript managers return a 
> Promise, but not all include valid data in the response passed to .then().
> 
> So, you can do something like:
> 
> // @grant       GM_xmlhttpRequest
> // @grant       GM.xmlHttpRequest
> // ==/UserScript==
> const gmXmlhttpRequest = typeof GM_xmlhttpRequest === 'function' ? 
> GM_xmlhttpRequest : GM.xmlHttpRequest;
> 
> You can then use gmXmlhttpRequest and be compatible with all userscript 
> managers of which I'm aware in nearly all circumstances.

Source:
https://github.com/greasemonkey/greasemonkey/issues/3160#issuecomment-1456758080

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to