gmxhr is a
xmlHttpRequest API wrapper for Greasemonkey (and derivative) userscript engine's
It provides a
xmlHttpRequest API to the
GM_xmlhttpRequest function from the
legacy Greasemonkey v3 and
WebExtensions for Firefox and Chromium-based browsers.
It is also compatible with the new Greasemonkey 4 API
This means it can be used as a drop-in replacement for higher-level libraries and frameworks for the standard xmlHttpRequest class, including superagent and axios.
$ npm install gmxhr
As an example,
gmxhr can be used to allow jQuery to perform ajax calls using
GM_xmlhttpRequest within a userscript:
var gmxhr = ;...$;
My thanks to Ryan Greenberg and Martin Monperrus for creating and sharing this code.