Greasy Fork is available in English.

GM_fetch

fetch pollyfill using GM_xmlhttpRequest

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://update.greasyfork.org/scripts/421384/1134973/GM_fetch.js

Autor
nyarau
Version
0.0.1.20230104124032
Erstellt am
07.02.2021
Letzte Aktualisierung
04.01.2023
Lizenz
n/a

fetch pollyfill using GM_xmlhttpRequest, not yet 100% replication of fetch API (eg. errors)

Don't forget to add permissions

// @grant    GM_xmlhttpRequest
// @connect  api.example.com

Example

GM_fetch("https://api.example.com/favicon.png", {
    method: 'POST',
    body: JSON.stringify({message: "hello world"}),
    headers: { 'Content-Type': 'application/json' }
}).then(resp=>resp.blob()).then(blob=>{
    open(URL.createObjectURL(blob), "_blank")
})